From patchwork Thu Feb 29 21:20:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13577661 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 60A53C54798 for ; Thu, 29 Feb 2024 21:20:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB05C6B0098; Thu, 29 Feb 2024 16:20:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DACD6B0099; Thu, 29 Feb 2024 16:20:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87AF66B009B; Thu, 29 Feb 2024 16:20:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7A7686B0098 for ; Thu, 29 Feb 2024 16:20:51 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5A66A403E0 for ; Thu, 29 Feb 2024 21:20:51 +0000 (UTC) X-FDA: 81846111102.01.0080F88 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id DD744180026 for ; Thu, 29 Feb 2024 21:20:49 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PjmFL1Pf; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709241650; 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=rya1zlsULsETzm/GlmljPwgeJ3mzf+dS6TYF2G2lgAo=; b=CnPp06Aw9RccvLuA2PZFx9upRc5L9biyl787weWIIrQ/wrDe5wDqLyV26HzKcDhpWHF10f pzVE3XT+1mgwPHIBFdy/xmjPspoKZAIocymkNhQXz2CXs2QJqRt+NoFK6WVO64EBGVaTCr U4pIsTm7uDn0g4YFJv40iT7OL2RNVi4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709241650; a=rsa-sha256; cv=none; b=0oBy3GwPOS/WVoVYwG7LyQ7tKzi4OLxAa3+PsFC2MBxkZsI09jo3xqcgjKBbVSRsqr1y3L MLTz/dor/vSlcF2BS/rokqMQeDcs1amh4RZ6/SelFzzayxB/SqS1RwS2g4REgOUbxPYLsY Rh8BfPZeF5UJAHCzvXOP3ZngZlDWISY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PjmFL1Pf; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=rya1zlsULsETzm/GlmljPwgeJ3mzf+dS6TYF2G2lgAo=; b=PjmFL1PfcYX4M83CrIJVZ32W1Z ql9mm3beilHg9iG7pANyDoH2hkJOcVxeVt8OcVi6RAzCKL72RlkwMjT3O+jUCj5ZOTKnJU6jSUhw4 MjzlHh+ngmiuB0TMpYlrGAuK16QqKNL7j4Je6mwpOhih1yUwZzNqw1ShwN14zd4+h5SmtuK2h5xvm DP/5OhRQGC37T1hyBNOG67UPR8W1TUFRBUkxQkFO80WNKhCrbBfkJb7kkNE38kD2VzUhNqkUcq9sV WNQZ7VC5J+5oLYDYTIF022zx6noKCohDbpe+lA3ncYGs1gDwXLi5bxRL2evYpFWrq439k4q0Js3ip ABlOYrjQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfnpV-0000000949Y-2own; Thu, 29 Feb 2024 21:20:37 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Miaohe Lin , Naoya Horiguchi , Longlong Xia Subject: [PATCH 2/8] mm/memory-failure: Pass addr to __add_to_kill() Date: Thu, 29 Feb 2024 21:20:28 +0000 Message-ID: <20240229212036.2160900-3-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229212036.2160900-1-willy@infradead.org> References: <20240229212036.2160900-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: nrpp1g3pdza68hg84u7prxa7xkdc3km7 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: DD744180026 X-Rspam-User: X-HE-Tag: 1709241649-426116 X-HE-Meta: U2FsdGVkX1/YqZDochCMXF6VH7l2upyYRJ7eaTNvFHi8lAZdNub+TZdgsAVwd9RQr7knOTS/puIxz891h/++EVLjODXE6rdDU65QN+G+x8oVqEbCalUOaLjPu4Rs8gk0PKD9tNT2/EgsTtzyb5rFT8QTb0KAaMu2aQ6dTMus/nbPvs2+ezqesYr3WDjY7uYxv2FKCSKX5uI49Qd8IWKQaYX0I6dx/Dbg9AfqbbNMZ5pp4W1pioOQhEpy6yQpHi3+B+7b2UTtjHvU0yN/xTJmVr3MCVeHP9lpE/TemUObWUmKdT6E3ff1jfsa/P+8Ejt5eMGhig814RzKy52pm3pJIv0xJJoV2TFyGv34N4ZK4um0X7QwGDm/wnUsqJua49jeawvA4PBTPKXvViIckUKBUPRoV9KXFq0oXC40aM4qGzUewyQxdO6nfVBEYJk3NofqgEKXjWlaAyvSfKtnclOj+xFcEFJWGiOEEiFysdzm+frlRhN482sT7GuOjKBHClNthEqTNhaDRRhvmVHJRmXjFnWhhiEfw2AVmcFHTpfJfBNzJ8cdk/lM1YJNU2OphHhmpX9TnEulPsIvO/Ceh+/fzDc/rSfyg3hsLlQFxL9hjq2u3OnXkcphqhcW7WowwErJxQKe1HLswM7JVbzWH+HulYd6k0sCaqw7foQm3S6aHhlTWmwE0FsdxeG6NVzMQdr+GCHeH/pDiqzhF9K9AE2D1FkeqIzSAxQL+sLvzDXb7EUnuVAPRy9tQYmi1dCS9qt2dcu04nFt9e5deSbsWDRQXTkYSk0sOiQOg/kOXXEnpS5MmMThfjpA5KuSHIAH+eCMW+DEVvrM+7A4uDqeAtt48MXXzwltYdHYeAJ7mXtwCFJCzyeJ523B1q1DL+rohs6ZghPw2ojm+CZXv/XUIYm0CzwwrWUS6WRV 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. Signed-off-by: Matthew Wilcox (Oracle) Cc: Longlong Xia Acked-by: Miaohe Lin --- 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 9356227a50bb..7f8473c08ae3 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -432,7 +432,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 @@ -465,7 +465,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 @@ -481,6 +482,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)