From patchwork Wed May 29 11:19:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13678711 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 3A785C25B75 for ; Wed, 29 May 2024 11:19:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ADEBC6B009F; Wed, 29 May 2024 07:19:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C9A46B00A0; Wed, 29 May 2024 07:19:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81ACF6B00A3; Wed, 29 May 2024 07:19:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5A1436B009F for ; Wed, 29 May 2024 07:19:23 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0F5D6120503 for ; Wed, 29 May 2024 11:19:23 +0000 (UTC) X-FDA: 82171187406.18.9307A7A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 5B945C0004 for ; Wed, 29 May 2024 11:19:21 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TmAeWmKW; spf=pass (imf10.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716981561; 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=lXRirrIvNUFDVUMts2hQOYTUr+V+4XzCDnXRbx7dYx4=; b=X4BHnSPnYo7scxPI/qzL1Z9856vX+e1bb3vzmu3z7jCcEY+63yY8krqiyiOJEElyhFnJBB 2PXAy2qLykvXFMaAO3jaAsiTT5F5L+BOnjfjvUncA7otXZgtegW/ib/VYjvtKfdACxwJuT vmvjp89m7J9anWtqFYWXZhb5FOYNEE4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716981561; a=rsa-sha256; cv=none; b=BmUb15axEwaH1bHxxzF2h+RU/0FSHIN3slC7OyYIluTCfo4dX4WFL7+Fa3tJyvWEblreej RX+00Ji7z/a3NFZDmFiYQXkT126sBGkMrB1cjoeUbA/3qFkF2EgVeqGvdduqoVUPBm0hQn +QmREU33qk1ioLOA6qgKB6qitFthSGo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TmAeWmKW; spf=pass (imf10.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716981560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lXRirrIvNUFDVUMts2hQOYTUr+V+4XzCDnXRbx7dYx4=; b=TmAeWmKW+lBYlXlXBPi7HQwYE5PqFM+SoWgfX7KUxRBI6tROOYKRqwPTM91jyQ0BGRvvPh zJ0VNEqv40NTTTCSFP7ybUcigXDzDW/zNBRbb1krMDZ+TZYOfyKsXHHKkVAjDvsfxxeIcQ 3n43J1MOi7YURmSj7MgNoxI8DEXQ6LI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321-I5NU4P9fO96nrEfFJX_p9Q-1; Wed, 29 May 2024 07:19:16 -0400 X-MC-Unique: I5NU4P9fO96nrEfFJX_p9Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7EDCE1C0512D; Wed, 29 May 2024 11:19:15 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.193.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1F68C15BB9; Wed, 29 May 2024 11:19:13 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , "Matthew Wilcox (Oracle)" , Mike Rapoport , Minchan Kim , Sergey Senozhatsky , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH v2 4/6] mm/page_alloc: clear PageBuddy using __ClearPageBuddy() for bad pages Date: Wed, 29 May 2024 13:19:02 +0200 Message-ID: <20240529111904.2069608-5-david@redhat.com> In-Reply-To: <20240529111904.2069608-1-david@redhat.com> References: <20240529111904.2069608-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5B945C0004 X-Rspam-User: X-Stat-Signature: 7sr4ds1e7rh18pfr7sjtendbbnj3nk4b X-HE-Tag: 1716981561-187982 X-HE-Meta: U2FsdGVkX19PiN2OWe+VyFI2sG/GbcUTrK3+DpN9wnbK/lzAxPpV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5BUkvFzNl7mqYD57giBXEc6re2RO2/G+15mRxKpDH/ZFiWGF5omqggm2/o+skcUYpMKBh+teRY8wxyaD6Cysb14KpXW5LJMgcGahghFHmvi+MiYRxC5hT7z7y0n9+twi9z1XfivmVjjbvXQYZWLAc1pjdOZUnLTD7gitt6 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: Let's stop using page_mapcount_reset() and clear PageBuddy using __ClearPageBuddy() instead. Signed-off-by: David Hildenbrand --- mm/page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b1e3eb5787de1..591d28b9f3e48 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -498,7 +498,8 @@ static void bad_page(struct page *page, const char *reason) dump_stack(); out: /* Leave bad fields for debug, except PageBuddy could make trouble */ - page_mapcount_reset(page); /* remove PageBuddy */ + if (PageBuddy(page)) + __ClearPageBuddy(page); add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); } @@ -1346,7 +1347,8 @@ static void check_new_page_bad(struct page *page) { if (unlikely(page->flags & __PG_HWPOISON)) { /* Don't complain about hwpoisoned pages */ - page_mapcount_reset(page); /* remove PageBuddy */ + if (PageBuddy(page)) + __ClearPageBuddy(page); return; }