From nobody Sat Apr 11 10:48:02 2026 Received: from mail.ilvokhin.com (mail.ilvokhin.com [178.62.254.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84CAC3ED128 for ; Fri, 6 Mar 2026 16:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.254.231 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772813191; cv=none; b=fQ0jr6i7xQmwWAkjbGemu+ANDxHky1MqkRySsNnHia+zBwQpBuSToLhb/q0e2ShNUoptmWgxJZnOKE+CNS3h+1+wXVHZTb6LkHRo++N8/ldcgSGV8BDL88khsrl1ILgJl0aELfwULG8lQ/ZkPiIz8jmCuTcIEal1KsFuI6/roqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772813191; c=relaxed/simple; bh=MW3YTlKixWpRUBRaD+w3lWCmZb2cAM96v+e91HPVHtw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=heYYnKie/Y/ul1Gfme3bRgefgMjoNkkIwp8HWbcb1AcvN4Q04EW+ILfEWj8NEnrv610kVmQqRay7XCw2R5znvjzP+WSdN4JmnunyQe4sBeuQT21dq6+qxxySYiwFrNDf1HyyXIW7iUyCyOMpO58I03fXFTjGGd3bbxFFMg2j4ZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com; spf=pass smtp.mailfrom=ilvokhin.com; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b=1bOrNU2c; arc=none smtp.client-ip=178.62.254.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b="1bOrNU2c" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id CB1C5B344D; Fri, 06 Mar 2026 16:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1772813186; bh=rAeOH5IgrtG9/UsY5VOxVdlGDjQqvvwATIuVyeglsuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1bOrNU2cmJL/WDIqAPD076EgHgoW/TaOlwkwVczxFJVtGhtPFQ0pXmMCIj0naFCRt 2zTpJP+5oBpkRdpb7ZhjuLAPiLnBv7XLrtohX+f86b3gi1eUzJ7VMQYv89YLomhWrN Xum4wt3f4RVV1F7EsmK+JdLH27ULXCzK1yoaC0ek= From: Dmitry Ilvokhin To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, Dmitry Ilvokhin , Steven Rostedt Subject: [PATCH 6/8] mm: use zone lock guard in put_page_back_buddy() Date: Fri, 6 Mar 2026 16:05:40 +0000 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use zone_lock_irqsave lock guard in put_page_back_buddy() to replace the explicit lock/unlock pattern with automatic scope-based cleanup. Suggested-by: Steven Rostedt Signed-off-by: Dmitry Ilvokhin --- mm/page_alloc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 92fa922911d5..28b06baa4075 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7524,23 +7524,19 @@ bool take_page_off_buddy(struct page *page) bool put_page_back_buddy(struct page *page) { struct zone *zone =3D page_zone(page); - unsigned long flags; - bool ret =3D false; =20 - zone_lock_irqsave(zone, flags); + guard(zone_lock_irqsave)(zone); if (put_page_testzero(page)) { unsigned long pfn =3D page_to_pfn(page); int migratetype =3D get_pfnblock_migratetype(page, pfn); =20 ClearPageHWPoisonTakenOff(page); __free_one_page(page, pfn, zone, 0, migratetype, FPI_NONE); - if (TestClearPageHWPoison(page)) { - ret =3D true; - } + if (TestClearPageHWPoison(page)) + return true; } - zone_unlock_irqrestore(zone, flags); =20 - return ret; + return false; } #endif =20 --=20 2.47.3