From patchwork Fri Apr 12 19:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13628295 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 8CEB6C04FF9 for ; Fri, 12 Apr 2024 19:51:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4534F6B0096; Fri, 12 Apr 2024 15:51:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DCD36B0098; Fri, 12 Apr 2024 15:51:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 255D46B0099; Fri, 12 Apr 2024 15:51:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 07DBA6B0096 for ; Fri, 12 Apr 2024 15:51:52 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C81861407A8 for ; Fri, 12 Apr 2024 19:51:51 +0000 (UTC) X-FDA: 82001925222.13.749E76B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 39E7DA0018 for ; Fri, 12 Apr 2024 19:51:50 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Xvr+Xqxm; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712951510; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Tnq6NiUN07vNOZ2QsHlIu5rppou5nXdPST7AYt/sXEQ=; b=KcYr+xsuhjr9NcOr31FKGk+7hNXQPJTsgbr3tGz/0bNTdasQenUdEB/hgvbAr3krPp8/l+ ZX+jsF1XGPG0b+Vk2sPFgwTNjIZbqWz2qz2gxPnqGJEN17kWoXbYB2dB2GzPkEL9JVjaTI xfJsy3V3JNNQ3xs+kTPAmSMvsuSt4pU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Xvr+Xqxm; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712951510; a=rsa-sha256; cv=none; b=u8L6jWtkQ22lu/6MRaDk1etPw3hp/PB3pYR3l6gMBTpc+qhWtk4UPZ+ZUNRoWw3UbhvzXy r/Dce/kiaNnROvg9cCnQoxWxHOBirS8Zo0Bpt8hljxSWT9kKlz9P8pIQx81xkP8w/by5wf 7PiWUqcXmJ/EFRdSGh0zKRVd9jD2lfk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Tnq6NiUN07vNOZ2QsHlIu5rppou5nXdPST7AYt/sXEQ=; b=Xvr+XqxmjcVkFr0sNpLDvo8/UH 0Z43DaB9CcIRlCdJjgKj8NIX8u5VNdBIyKSxS7x7sIG924A9Km5+eTJL3iZnK3fHGbjo1d6f3QAgd yfg2DbAsMLrSg+m7DTv8gxcyjKRIFt86HrgE/EIyBAFUziMDXwk2CCIm0n2AQf9/d8WiAgKo+tOAs gyr2mEweOVyJRWeDXORhwVdeEMdgyoJncJgSKKBUsGRfWzMXy8F9IFDV/V0wk/TeqJ8//TEy0r8Ph 6D2DUsawylOAp16MgG98JmUt9x6R/n8/ipWEX3USUS7AYxsqWOEkffLdALEXJSsJTqfGyImxRYjMh Vxof/R/w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvMg3-00000009t9g-2m9G; Fri, 12 Apr 2024 19:35:11 +0000 From: "Matthew Wilcox (Oracle)" To: Miaohe Lin Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Jane Chu , Oscar Salvador Subject: [PATCH v3 02/11] mm/memory-failure: Pass addr to __add_to_kill() Date: Fri, 12 Apr 2024 20:34:59 +0100 Message-ID: <20240412193510.2356957-3-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412193510.2356957-1-willy@infradead.org> References: <20240412193510.2356957-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 5xpjdfsp1er4cxk9uwaxz4o84zqnjc5e X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 39E7DA0018 X-HE-Tag: 1712951510-706407 X-HE-Meta: U2FsdGVkX1+Rvdb8oIWa4BbBUobChqILPb+81tVFUtC8EmlAhZ+a3zGnjENWBbEQb43d9xRpmmfO4A6vbbzp5D+Vcru/5U2F619MDOD4ks5XIB914PYr05Ak5I6CeViB3oFFkRSkWH6sO8jEcZIq9g3WWrORl+LdygV1LNqhwz8vVyl/VH/QLbXf4vniKSHvHBDYjXsTzWHYRq7XPwgOJucjRpsKwnuVcR9i7vPr5vx4H+qGqoAg7nmc5i/GZbT1/Zr8YUZgaS5bwLk2HX1rMrFSYxWi1gEcI1UsEku27EXp9Kc+OI1TOeskP2xX+PRHbVbuFcf5PqYCe2qdDNGSDs23qvZrmgGwTlCZc0FuqU1n4r55Vu9MLHihin67f6jJhFHYfk3jy1P3MIBFcP9YbtSj9NjcvUG+Y3fZ2JKguceIbKXSPumYs/NHE4IBq7Vn114gnueGO/3hlXfcFV+yW6YkHqkYxsRMAZmijyDZf37diwSI/AWr/i5YCaWaM251zRu2IW3GdZprO4J373ozNvJFMiIkjptgVMlnwo/OLJyBohMndFFD3qm7md73S/MxUkTa6HBl2MrqZb7MVU6FsJbRfki67h8+j49J73jhzXbG0QOEDhVNFOyD5QU4JUNGQW3mpUQ1RRu+fJ2QRLeeJUD5rtpredTXHQLAZuLkFGMwfj9i3WbTKcSXh0kuxcV/h3460y6VpH4Nfu9B6RprF/jaV9x7o2XT9l03rrmYh7n8HDh4Pn0v0MN2hM2WDh3ipDMP46Tc2zY4a7IT8HhY0FWFxvFWcd6P4gdm1cqdTy7JecJDww29ptec4hDJkalfO75EfHpQIlPjLtLtSRTnQiAXrrpOCkiZ1nOsLm1vsZiNEANAbTMSmrQSbuYOg/rQZWux/jtcccRI+ZIhEv1lPmgk8Wvxy3j1UwRvDmLf1aphx0ZZp/sdjLXtTMND+JoPRvqmeh2iBwypAI13G99 XnNiUhcI O5A0uAgadNhiNZif01ghMeZqyUBfMwrnx9GJW0JKEaue2ldDx7/WjH6OUJ4uSRpWYYF0awOGf/TgzwjLXuZu/X5mlQwJVxlAAADwwz2sc4yRCeutYTDj+PAUa9El6u7G1a4OFcY5l4AFv7EJngupOq/buB0AzwzJpt7ZTubN/OTce5rrsR2tKFWrCJzIc0TybZ8OZoXjR8llzUvQoEhbCugQjRxuFaxPOFyXLoOSLobbGXbB6Kr/z0xXkKj1Btj/1bHR4NOR6JuvI+Ms= 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: Handle anon/file folios the same way as KSM & DAX folios by passing in the address. Acked-by: Miaohe Lin Reviewed-by: Jane Chu Reviewed-by: Oscar Salvador Signed-off-by: Matthew Wilcox (Oracle) --- mm/memory-failure.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 8adf233837bf..aec407788df1 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -437,7 +437,7 @@ static void __add_to_kill(struct task_struct *tsk, struct page *p, return; } - tk->addr = addr ? addr : page_address_in_vma(p, vma); + tk->addr = addr; if (is_zone_device_page(p)) tk->size_shift = dev_pagemap_mapping_shift(vma, tk->addr); else @@ -470,7 +470,8 @@ static void add_to_kill_anon_file(struct task_struct *tsk, struct page *p, struct vm_area_struct *vma, struct list_head *to_kill) { - __add_to_kill(tsk, p, vma, to_kill, 0); + unsigned long addr = page_address_in_vma(p, vma); + __add_to_kill(tsk, p, vma, to_kill, addr); } #ifdef CONFIG_KSM @@ -486,6 +487,7 @@ static bool task_in_to_kill_list(struct list_head *to_kill, return false; } + void add_to_kill_ksm(struct task_struct *tsk, struct page *p, struct vm_area_struct *vma, struct list_head *to_kill, unsigned long addr)