From patchwork Mon May 27 14:14:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13675412 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 5688AC25B79 for ; Mon, 27 May 2024 14:15:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B98A26B009D; Mon, 27 May 2024 10:15:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A72596B00A2; Mon, 27 May 2024 10:15:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FF296B009F; Mon, 27 May 2024 10:15:19 -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 48E906B009D for ; Mon, 27 May 2024 10:15:19 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BD5BBA1530 for ; Mon, 27 May 2024 14:15:18 +0000 (UTC) X-FDA: 82164373116.01.BE158C2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 2443280015 for ; Mon, 27 May 2024 14:15:16 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FH0Indix; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.133.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=1716819317; 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=hshwfl98bML8acqrBVRK8K6pB1i4C/7ItyePT11o37I=; b=OKcLz4xeb+6eMLLFBFnazEBK9E/bnf0DpTCCofyZITBTWip3APaJ+PXukEJdOdJs/OoJ7J vTJIW86flO4i4tDO3hWWStUTQoDkksQ05LOtlsNddxql4aq3l3klkaqHfTbgL14Pa55PHd rhWsrvLiQO3tgjM3YtmTD3nk920TGgg= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FH0Indix; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716819317; a=rsa-sha256; cv=none; b=Eu9Ici8Ac1fJ81yPVtVFwTbum6AZIgpBW05MGugtSfpdQhWikG55Zg/iPoCuPGQjJfiZQ/ BI6qlvcW6sG16UZyINJlB7SKGETn0sGLbegHinAI3KwzT3me+8GritmVJ8IxHmEDAWvdkZ /ut+AUVnWVfjrKIGr6MtNbbdyTj4skI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716819316; 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=hshwfl98bML8acqrBVRK8K6pB1i4C/7ItyePT11o37I=; b=FH0Indix9f/mdiHiwZexNkJ4+ru6n6TNYOF6Q6CbGXwx5mdWfOgeh5jx/efXB7DHkC1VDL arORcoFolLjzYoMI0JVIwUbfZB+jktbga8pzKuDOydmeZbgZOPupAKuMqdyLpNw9ej28iJ uAIvWi+xIn4IRFaM7aKDut78yZ0UDMc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-AAUNmNJgPs6LTG_45hYmFg-1; Mon, 27 May 2024 10:15:09 -0400 X-MC-Unique: AAUNmNJgPs6LTG_45hYmFg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 51D76185A78E; Mon, 27 May 2024 14:15:09 +0000 (UTC) Received: from t490s.redhat.com (unknown [10.39.192.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 902091C00A8F; Mon, 27 May 2024 14:15:07 +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 v1 4/6] mm/page_alloc: clear PageBuddy using __ClearPageBuddy() for bad pages Date: Mon, 27 May 2024 16:14:52 +0200 Message-ID: <20240527141454.113132-5-david@redhat.com> In-Reply-To: <20240527141454.113132-1-david@redhat.com> References: <20240527141454.113132-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Stat-Signature: ojde8ubrkws5zxkro9et6gahed4axbmx X-Rspamd-Queue-Id: 2443280015 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1716819316-672148 X-HE-Meta: U2FsdGVkX18PDQXvTCNfwK7eMThGXzff53vGcBEOqa4bAly5GASyMBy60JHga2EDgukZWcjwmg6nfVCTnD04N0s0mJe0Wq/VhHQ3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w+BZjm8MCdno6eSYgk9ZJWjGbTNrQFLMLHKL/WZRKljspECk5VdaYRcjNN2MjnHjXfruQgDeSohMS9lc9+wuyBV2am/A7cotYLzR 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 2e22ce5675ca..b595342e73c2 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; }