From patchwork Tue Mar 22 21:44:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789204 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 2FA79C433EF for ; Tue, 22 Mar 2022 21:44:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2EB66B0113; Tue, 22 Mar 2022 17:44:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC2D96B0115; Tue, 22 Mar 2022 17:44:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9558B6B0116; Tue, 22 Mar 2022 17:44:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 815456B0113 for ; Tue, 22 Mar 2022 17:44:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 63C5323702 for ; Tue, 22 Mar 2022 21:44:39 +0000 (UTC) X-FDA: 79273351878.03.F7BCA4D Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf26.hostedemail.com (Postfix) with ESMTP id D46A5140034 for ; Tue, 22 Mar 2022 21:44:38 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9F52B81DAD; Tue, 22 Mar 2022 21:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C593C340EC; Tue, 22 Mar 2022 21:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985476; bh=aJvl14R3//yR6TUdAYyl92DPDqdsx+7yQr9sKRBh24I=; h=Date:To:From:In-Reply-To:Subject:From; b=kLB9x8YDFbqUP73qYGE2T9PxzKil09MTTjeOtYbrghLiBIsRHa18utt5TyvkZUKoe EXMUILpGMKqKTqW626JQfFgs63nU3jwKKvVYS7QS08OhF00Vvh/ePKpcmfLERr5eze xOYUaJ4BotQ6L5n27vY1YjxI7GWmvs9EmxrWT2z0= Date: Tue, 22 Mar 2022 14:44:35 -0700 To: naoya.horiguchi@nec.com,linmiaohe@huawei.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 120/227] mm/hwpoison-inject: support injecting hwpoison to free page Message-Id: <20220322214436.8C593C340EC@smtp.kernel.org> X-Stat-Signature: uxn1gzs71fgbjgxzgoi3dte3zk8irqeg X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D46A5140034 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=kLB9x8YD; dmarc=none; spf=pass (imf26.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1647985478-757003 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: From: Miaohe Lin Subject: mm/hwpoison-inject: support injecting hwpoison to free page memory_failure() can handle free buddy page. Support injecting hwpoison to free page by adding is_free_buddy_page check when hwpoison filter is disabled. [akpm@linux-foundation.org: export is_free_buddy_page() to modules] Link: https://lkml.kernel.org/r/20220218092052.3853-1-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Cc: Naoya Horiguchi Signed-off-by: Andrew Morton --- mm/hwpoison-inject.c | 4 ++-- mm/page_alloc.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) --- a/mm/hwpoison-inject.c~mm-hwpoison-inject-support-injecting-hwpoison-to-free-page +++ a/mm/hwpoison-inject.c @@ -32,9 +32,9 @@ static int hwpoison_inject(void *data, u shake_page(hpage); /* - * This implies unable to support non-LRU pages. + * This implies unable to support non-LRU pages except free page. */ - if (!PageLRU(hpage) && !PageHuge(p)) + if (!PageLRU(hpage) && !PageHuge(p) && !is_free_buddy_page(p)) return 0; /* --- a/mm/page_alloc.c~mm-hwpoison-inject-support-injecting-hwpoison-to-free-page +++ a/mm/page_alloc.c @@ -9417,6 +9417,7 @@ bool is_free_buddy_page(struct page *pag return order < MAX_ORDER; } +EXPORT_SYMBOL(is_free_buddy_page); #ifdef CONFIG_MEMORY_FAILURE /*