Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp219056pxb; Wed, 23 Mar 2022 16:45:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKV8uJ57znnhLFPoHOlctAjA8Vzge3dcNZk7uWvfxTKkB4qT1NF5sloTCFi0kcgLoLUvlV X-Received: by 2002:a17:902:8ec8:b0:154:5ecb:eb05 with SMTP id x8-20020a1709028ec800b001545ecbeb05mr2594677plo.56.1648079102941; Wed, 23 Mar 2022 16:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648079102; cv=none; d=google.com; s=arc-20160816; b=UQjqke5ZwdW4PTQOKi+T/zoI/f932SyIuMz04YnySlUCPbD6CLlnj1GMSk1utGSCyp IYOQqcZ/IGafvYhfTz8Z/iA/lpYsZteuQDF4Arp2xzpE1XitVgw3BsWHjkYpKU495iBt +5of/4IMI6yYHeJHAtA50UVZ8bthUpin6lS2DbBxj9qi0/3wzfyZBDnn92WX9G+H1s4e jzMrNC88G0Yk5D4GERHy9YQ3FxvaqkaausyMOv8Z+anRj5/egZiHwggcnLb4CaFj/Kqv LVQ2iMR6/PGGc8Y3u3imrurA0NY8czViXQzzbIeziO3S+OjfqFI4yYSuwv3r7G8RAycD busw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=OwPLDU5ROJx7nbiAvFUSiXwLBzuvc8gPh6XC+2xjHbM=; b=oZm+CndMRLI68ZWQsb1CIUYpiutAPe04GgpcOa+Mu9g9B+JtnEe14edOsm5xiT8axF ETtrvOjM4ucrb7FFtgyTJ0KnV+EfRibHp9aA7P3zhxFg9+iDu3P3qb7NHbyRmdfxeNv+ p/dUufBhSaydY49frfN5MwRiTyqGt0whnWhvmLYxVl0BOrPZvTqWg1GIHl+oh8LvtCXF ahn9WeJ0gQlBNwxDunhmImQzYafHp5iBibrYW39zbJVIEJsCYaR/XMW+RACei/tJ7PEw VELpur1JYi+TXLLgBrsqortKlWgQatKvmVx4nK2sAkT4Jc8wxANpkzLPI83S7TZHW7/9 kQGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=pHttAllX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a63b14d000000b003816043f0cesi22231006pgp.707.2022.03.23.16.44.49; Wed, 23 Mar 2022 16:45:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=pHttAllX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245147AbiCWP0T (ORCPT + 99 others); Wed, 23 Mar 2022 11:26:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245143AbiCWP0P (ORCPT ); Wed, 23 Mar 2022 11:26:15 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A37936E79E for ; Wed, 23 Mar 2022 08:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1648049085; x=1679585085; h=from:to:cc:subject:date:message-id:mime-version; bh=OwPLDU5ROJx7nbiAvFUSiXwLBzuvc8gPh6XC+2xjHbM=; b=pHttAllXElvSSZYfiwCKJQ6jsOtQjTsdu2TmeRyN5tMLzuDgdBdshb3g OW4uflVKJZQiBcqr/0BTMCGUCaxQMbiD6pLgI4ocECnBhDyS5jUd+YQmE UG1P/bwvAjyRQkX+eW/ryLt6f1MhaD3SujzhtJdGE235C14I3RJ01KkPm Q=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.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 Content-Type: text/plain 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4