From patchwork Wed Mar 23 15:24:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charan Teja Kalla X-Patchwork-Id: 12789832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 903B8C433EF for ; Wed, 23 Mar 2022 15:24:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8A766B0072; Wed, 23 Mar 2022 11:24:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D13C36B0073; Wed, 23 Mar 2022 11:24:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8C8D6B0074; Wed, 23 Mar 2022 11:24:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id A42CC6B0072 for ; Wed, 23 Mar 2022 11:24:47 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 50EA0A3ECB for ; Wed, 23 Mar 2022 15:24:47 +0000 (UTC) X-FDA: 79276023414.23.3DAEA6C Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by imf07.hostedemail.com (Postfix) with ESMTP id 53F9040042 for ; Wed, 23 Mar 2022 15:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1648049086; x=1679585086; h=from:to:cc:subject:date:message-id:mime-version; bh=OwPLDU5ROJx7nbiAvFUSiXwLBzuvc8gPh6XC+2xjHbM=; b=nEWTKY4PCNNjQsHFA6RMFjj7tkSk6JKPh78s8xx4KTCBE33F8riSZb6Y iPeshh//8HBySqpOySdxAQ1hRc7rEqproJO3tfxeY4pLiT/OdQnDRoOaM AdKm3h/zwABxGD2+lKLiFrJk0rQbGtmR3h7MVXG0y5CTBTFYmgIdOpsnW E=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 23 Mar 2022 08:24:44 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 08:24:44 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 23 Mar 2022 08:24:44 -0700 Received: from hu-charante-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 23 Mar 2022 08:24:40 -0700 From: Charan Teja Kalla To: , , , , , , , CC: , , Charan Teja Kalla Subject: [PATCH 0/2] mm: madvise: return exact bytes advised with process_madvise under error Date: Wed, 23 Mar 2022 20:54:08 +0530 Message-ID: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Stat-Signature: nbwr8q4ahhgks175nkszx5yzq3u65f4b X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 53F9040042 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcdkim header.b=nEWTKY4P; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf07.hostedemail.com: domain of quic_charante@quicinc.com designates 199.106.114.39 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com X-Rspam-User: X-HE-Tag: 1648049086-500713 X-Bogosity: Ham, tests=bogofilter, spamicity=0.004332, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Under error conditions, process_madvise() is not returning the exact bytes processed in a iovec element thus user may repeat the advise on vma ranges contained in the iovec element despite those ranges are already processed. This problem is partially solved with commit 08095d6310a7 ("mm: madvise: skip unmapped vma holes passed to process_madvise") for ENOMEM return types. These patches try to solve the problem for other error return types. Starting this as new discussion, as the back ground for these changes are coming from below patches, which are already merged into linus tree: 1) https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5bd009c7c9a9e888077c07535dc0c70aeab242c3 2) https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08095d6310a7ce43256b4251577bc66a25c6e1a6 and lore archives for the above changes: 1) V2: https://lore.kernel.org/linux-mm/cover.1647008754.git.quic_charante@quicinc.com/ 2) V1: https://lore.kernel.org/linux-mm/1646803679-11433-1-git-send-email-quic_charante@quicinc.com/ Charan Teja Kalla (1): Revert "mm: madvise: skip unmapped vma holes passed to process_madvise" Charan Teja Reddy (1): mm: madvise: return exact bytes advised with process_madvise under error mm/madvise.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 88 insertions(+), 11 deletions(-)