From patchwork Mon Apr 8 19:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13621554 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 000DDC67861 for ; Mon, 8 Apr 2024 19:43:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F7966B0099; Mon, 8 Apr 2024 15:43:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 559056B009A; Mon, 8 Apr 2024 15:43:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F91F6B009B; Mon, 8 Apr 2024 15:43:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 241096B0099 for ; Mon, 8 Apr 2024 15:43:06 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AE95BC015F for ; Mon, 8 Apr 2024 19:43:05 +0000 (UTC) X-FDA: 81987387930.06.98982F8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 0466E1C000A for ; Mon, 8 Apr 2024 19:43:03 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=V40hQZPc; dmarc=none; spf=none (imf21.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=1712605384; 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=8E7MsubpwK1pNCAdhISMwGNo4szPO+ok4gT94i6Vc88=; b=s/aNxHC3RJ+EQVP1VXF81SZ4ZbAdOjZ1fWs3AZdv/zgv6ZnP+6kW+EuopBBp2dZ7uFbnTJ w/3JJqPo4npQeV/zfXEK3SrsHwZcmeHpEVDCAhj4pvs7JyqlLYA4ApvuEZuORdBMNeUcHk /dL45Ju+tCuq4SwWAIK614MyAt5YRKg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=V40hQZPc; dmarc=none; spf=none (imf21.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=1712605384; a=rsa-sha256; cv=none; b=G3F4c9sVpnFAopVkWofBU/n3TYN0Wl+yYP2Duv6FUbfT407kjZ12K5u6+PVbKdOBK5FYdd u2jphu3FduvQAHlcWExoQP0EB/lW23ccGdb126vewsMPD7jzFDt9eCUQj7U7xMkHnV1S8m uCFOHrkeADRUVHGs40dCNCSFacnR0r4= 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=8E7MsubpwK1pNCAdhISMwGNo4szPO+ok4gT94i6Vc88=; b=V40hQZPcrc6tgfB3XlUFhKvAZ8 VuYKS1A0PIMO25yNo+E2aXBGQqmBSvmDuwuCt3X0+C/zDCNcBwKmFp46cmtBxRV6cuq4HOyqOhvvk txy4tBqSy1ySbDnR/FcNXSg4/cHVg38LE/okJfeXFxkW6rFaqsakyCzdTNimBTq3eb+YpnebYADO5 AuoL85IaOArQxU3zbhFS9k2DvwnUNu8WlDy7J4wz23efelg5shMkSw2SgZn34hE1LY5wMbVWHmqzI PbProQJU8pWtoeREhb0QV/LMsP4v0sEbFgVhTyZDqJezmAqMf1WvCSt6zIX6LE4XV9seEv0UQWzFL /GT1dmFw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtut0-00000000UqB-3Qyu; Mon, 08 Apr 2024 19:42:34 +0000 From: "Matthew Wilcox (Oracle)" To: Miaohe Lin Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Longlong Xia Subject: [PATCH v2 02/11] mm/memory-failure: Pass addr to __add_to_kill() Date: Mon, 8 Apr 2024 20:42:20 +0100 Message-ID: <20240408194232.118537-3-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240408194232.118537-1-willy@infradead.org> References: <20240408194232.118537-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: dbcu6f9twpro95j65tmqke9c355i7eu3 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0466E1C000A X-HE-Tag: 1712605383-272846 X-HE-Meta: U2FsdGVkX1/Iq6piA8SytrvEJ3fpTQezjRTINH89oauXsnNZwpSkNdFIq9GJhXpp0IXT1xFc/nc1HpvEDhrm9Ayel3Ame2llnHIaIEyDjaP5qbobCfwihrZASsBOzSyS/8ee20KGbpoKEhICPls4DrBXnvIGwYTOf38OZXHABI8nmvCwEs5c/DW6jjDi1ejN/QR+j0JHIdJjSlGzUhQoLzkz7yxW/8wWZRkchaDicWyBtOpmp8yLSMoDjvtiBzNspsMtL2xhtDwPKEDBex0ueKvcpZJzZeG0Bb+gLdrkgb4LtDMMKkKPoKTWM3fKprv2R6x1gjmHvvoNSpCJyaHLKUxFrf13NthaQmTMriQcUDDvWt6BN+kjDgIznc8L7cxhIANUP1+BfENgqo9QWPbLuS+Wm+CIb3hTy3o+lUt/+KszChM3tiCL47HRXLq1ZvW9rW6+RTxJV5K6Ss8KzugW+SrDwY7K8x2H+P5vrxc31PJiqbVxDJUEOuBzA3Dp4tpfVKPek6IlhICGnWZ3Rso3coK6Img6ae1C9fWn/L1oDrApRPdou54r/hs5YQwVVMTtBR8W14PdRC5m17clGv0SrzKFSpIt7jYraWQDdrEEOvnwov6661QV9ynb4dLZyTSCxiu1czccdBedhYKFRwnHX4bGPlRzspAV/HBMjRSCpDVaGDdGRBz79jXZlPOuwhsR0F43G+Eq2eMS5w8SdE5z2NjjaIlELuVpacaKeou8LwywTArtKoYtkFPwXWFFVx6aSsXFzDRSwC6d/DzaPbB2lxVvLrS1WLEq8O1vq9MuDEYECRMyQTIbyiCbiMuP1ppAbFwHqgWCNtVPxqvZU9I0kyY0ddN1X+Ek12Nd4gSuidLkEcakUVDdNyUu6wyDLGoCsG5yPNMyfA2n8aKqfQB+ohy9vUGOXwcgVy/GAUF162kUSmMoRWvFTciHsoiLr8VpSZhy3jnlNt1KZkXx1OF 6wMTx+lW cWJXSEU4EQHk8atEFscPr2jsa+U/5bglRxuXraH6+6ab8JMp0GmElKhcv18ERJ5lQcmCbXFqm0chOmbaJu2zlpiP4wClxXWAU1HOhiu97tspqZVSW2togSaybvoVjCL2f3VeIFP3/dfqNiCIVTA7w5dJEU2BcyY19DRvo1eO9NFrwMN7p3SkssxseCivnkxFTEgAHCKCdKqQlQain3cyMCvRk+iD+X0V6jLtHgIwCTDEigDaN/SVcw50JWw== 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. Cc: Longlong Xia Acked-by: Miaohe Lin Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Jane Chu Reviewed-by: Oscar Salvador --- 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 34b3c8255c9b..f94d85075ec1 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -431,7 +431,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 @@ -464,7 +464,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 @@ -480,6 +481,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)