From mboxrd@z Thu Jan 1 00:00:00 1970 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 AFF07CD11C2 for ; Thu, 11 Apr 2024 02:56:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7D4D6B007B; Wed, 10 Apr 2024 22:56:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D2D586B0082; Wed, 10 Apr 2024 22:56:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1BCB6B0083; Wed, 10 Apr 2024 22:56:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A5EBF6B007B for ; Wed, 10 Apr 2024 22:56:14 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 621C11C0CA7 for ; Thu, 11 Apr 2024 02:56:14 +0000 (UTC) X-FDA: 81995737068.20.832C23C Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id 39D5840005 for ; Thu, 11 Apr 2024 02:56:10 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712804172; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uu1v3n8Ozxtb7HHgT6CeEAqyvL3v258fg06WS6NvSBs=; b=AY8unaFQiuX0Ij9Sd9K8OxMJtRiLKEWjm8ci/2ca6NmwjgxKEthmMufCJX4WlTtFP118YQ 2u8VW0qcNt0IAJGnq4glT5coVxGP03EFsoBmS1LFCldpsqw/KeijCnhctSsZ1l1vwBr45C WmKl8Eg2PBb9DpNEewkVNTusVZV80XQ= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712804172; a=rsa-sha256; cv=none; b=MhdCAiIRcuRAnIhD/CujNLSPCth4dPk8KgSQMN/8KWbZIldiFK5tNwWSI8jkE2zfQHTwKF nP9Ll7zfi9DOVl32Vo5A3Q8NS3+zqXGRcPfaECWf0TzgpKui7cQIOL3JAzm4uS4sYuPT3W WnU8cVlP8YOspWJlFcLCLkbOKh1Bbds= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VFPQV3rhfztRy8; Thu, 11 Apr 2024 10:53:22 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id D39B7140E97; Thu, 11 Apr 2024 10:56:06 +0800 (CST) Received: from [10.173.135.154] (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 11 Apr 2024 10:56:06 +0800 Subject: Re: [PATCH v2 03/11] mm: Return the address from page_mapped_in_vma() To: Oscar Salvador , "Matthew Wilcox (Oracle)" CC: References: <20240408194232.118537-1-willy@infradead.org> <20240408194232.118537-4-willy@infradead.org> From: Miaohe Lin Message-ID: <88bbb67a-1d60-4a5d-eb7e-061c8dd41857@huawei.com> Date: Thu, 11 Apr 2024 10:56:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.135.154] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspamd-Queue-Id: 39D5840005 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: gmdfo8y7wcw3qqbuocbws6s8e7chx5kw X-HE-Tag: 1712804170-969680 X-HE-Meta: U2FsdGVkX19VTWSGOJGhZPY1tu+KFuk/G00AcN0z/jNJB9/16oTxKg8cl+GrtkiX4jERGzwb0bgcW85SlIsiX6HMf8yWS3kml5e80mgDSXvsDXybHdAMwag9+ySSAoZ9/WhTgE11cnEY26+iFsdWEphdwW/FX8wDKeCILp2MA5M4v1VDvKzY/E4bofhsGktuD08RrOrRrvxdeuIlrkl2qdeRMb/Fkcaek3sogcrpPAOQLKIB7G3TxlZrkUiKbGIZj7/C1KYzNETqdJppTdhqRlEahaFXawTZ6+9p0r6l0/aCwE1S883gGMuKNnl+l6W6o/Hx+tRjw0p+MhKhJAqW6hEwmY21RgkWD7kfibn9+wSsvzXbWrmibE9TrzBbSWdAfCZBG9rDxSp0zAxqJ/6a/0/paozR3st3qqMaZCMcLVFASQ5edATN4EQWmaU6YeyskTHo6tj1isdI6FUJruULTb0fTFpruvcdyzFZ9G8EM8fN02JvMPp1Xxj4s7v0HeWptG1lITUtTyRLyU50AV5wYXdH+X9qYTdaUyLr6drrDRsUyZEAfZhKkpR/VrO8GzRWHg7HN5SATW8TYyeN3UyUH9WhCmMzAkhrBO6RMLYkaTPsmdMTNAxK/SVtcD7oA8yCQs+WZf8gtkqkvzLR6nyiJZ5tws6F5N4ouZxNW9mkLo4azXse5Ty52gEcumEOGplY3Uh7QtJBKGYlQinxXCssyYbmezwqdIEiG5gFzOkryXPzmWqeKAqPgZbE1NmyauOPQQ8MaX0m90mZcf2eBzSsHHJzgyW2zkUbmpNGmjU+PDPBfUFTFamxdpojiIwdMAk18IqH2xB6cbF78hLf9JM2ZRsSjNOpRDViJmdmuZ+xOPAyPsH4Rza+NoL0XpboBSycHHjJwe6VkgMZrXplrCByhKrm49chw6yX+QnNPV2U/AM8SqJegp+VeMiVqDNGjr/JD1nQVbE2OTfwsrOpRzj 7ETBQdH/ 7Cm+5YO8ZmRAkXTTw4c2ZxYNEIRPAzbA6AdFlRvVymE+hOqx6maNcX7QC7dIrh457AUMR2jDrFPL5MLsV+yFlDcFHfU2OkNZ4rYs3+Cnkv/STwsxVjxU6yy0GCnQekwC1SBaSVefSqe7LXp95LpIeYNe7yVl61l+kBkKRJJDHNEqBL6G60s91pEBwsXawmQxEAXde8988+VLVQ8PBzCZjslAlef/YaZIpEM3k86UFvJxTmxXFrFdScFG92GZwGJxYgUOdlC1lnUTX1XjHTdzLYM9C7Ft5zsdNvaOUoAKF/4cnpNv5yYNji6iW0/PpNfoRWRY45Jn9W0ZWfm7Lip2x7XxKFtPCDWrGQo7I175Yz56drEIdQcwCt5Azqg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/4/10 17:38, Oscar Salvador wrote: > On Mon, Apr 08, 2024 at 08:42:21PM +0100, Matthew Wilcox (Oracle) wrote: >> The only user of this function calls page_address_in_vma() immediately >> after page_mapped_in_vma() calculates it and uses it to return true/false. >> Return the address instead, allowing memory-failure to skip the call >> to page_address_in_vma(). >> >> Acked-by: Miaohe Lin >> Signed-off-by: Matthew Wilcox (Oracle) >> --- >> mm/page_vma_mapped.c | 14 ++++++++------ >> 1 file changed, 8 insertions(+), 6 deletions(-) >> >> diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c >> index 53b8868ede61..48bfc17934cd 100644 >> --- a/mm/page_vma_mapped.c >> +++ b/mm/page_vma_mapped.c >> @@ -319,9 +319,10 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) >> * @page: the page to test >> * @vma: the VMA to test >> * >> - * Returns 1 if the page is mapped into the page tables of the VMA, 0 >> - * if the page is not mapped into the page tables of this VMA. Only >> - * valid for normal file or anonymous VMAs. >> + * Return: The address the page is mapped at if the page is in the range >> + * covered by the VMA and present in the page table. If the page is >> + * outside the VMA or not present, returns -EFAULT. >> + * Only valid for normal file or anonymous VMAs. > > I am probably missing something here but I am confused. > Now we either return -EFAULT or the address. > > But page_vma_mapped_walk() gets called from collect_procs_anon() like > this: > > if (!page_mapped_in_vma(page, vma)) > > so that is not gonna work the way we want? > Should not that be converted to > > if (page_mapped_in_vma(page, vma) == -EFAULT) > > ? It seems this patch is incomplete. It forgets to change the caller parts as it once did at [1]. Or am I miss something too? [1] https://www.spinics.net/lists/linux-mm/msg375668.html Thanks. . >