From nobody Thu Apr 2 17:14:28 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 01E86347525 for ; Fri, 27 Mar 2026 16:15:13 +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=1774628115; cv=none; b=MtJ1fGt0Tjf46FTPWMiwocWOwRXO4Vaiv8P7QUzoSk32hQyPTBh72/opBIYJNFmD8mAcNGK/8GyKIC5NytD2zMvVZGF1HbQxeqxVgvZ4JflJAR01vY2KHdqNJ5vaYIc31Ffj//GejGFS7QSDjK26NWvN28NBkN2x/RNG/WgurlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628115; c=relaxed/simple; bh=57/qH9xAbRIyf9RAucgI/mrG3n451TzkFs7sLdOpcik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LETJmMM4FtilUYejTWQIbtJl4eLCTYNxFcAAlMcZ0ROC5u7eC0ZCem9719BxLRJjEZIjn6gHg7uoysuuUlhblr8r0Z5GZ5BOoSLAq4LTUC+vLLMUVfJv80RTcIFBywXguqBxZqgh05luQpcvivxMrkPs5AVX5HdPtWT/B1JtKuo= 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=BQylBdA8; 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="BQylBdA8" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 6916ABDFF7; Fri, 27 Mar 2026 16:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1774628106; bh=ArU+MbvPpoFkKDvCEB2tIeK2zHviaq/MDLrCwpLr79g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BQylBdA82DK3qa/LV7ggfzcm3OuLgwGoZuvwiUEGDnO0WlhtLZkobZfClPSbCx+/4 CiHDWBd+bFkguhjyIynKQ87Mg6yUxwLDiI5QWFLukxLQnN/RYa8uGaJGo/jHxEnMfw 6rb5h/gn5ukO5OFwqkkfnZEZiPNswCuUCldNWREg= From: Dmitry Ilvokhin To: Andrew Morton , Vlastimil Babka , 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 v2 3/8] mm: use zone lock guard in unreserve_highatomic_pageblock() Date: Fri, 27 Mar 2026 16:14:43 +0000 Message-ID: <3fec3cca1eb90a4295f73055514502228ec0e9a1.1774627568.git.d@ilvokhin.com> 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 spinlock_irqsave zone lock guard in unreserve_highatomic_pageblock() 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 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c7b9b82b5956..f06d8b5ffc88 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3452,7 +3452,6 @@ static bool unreserve_highatomic_pageblock(const stru= ct alloc_context *ac, bool force) { struct zonelist *zonelist =3D ac->zonelist; - unsigned long flags; struct zoneref *z; struct zone *zone; struct page *page; @@ -3469,7 +3468,7 @@ static bool unreserve_highatomic_pageblock(const stru= ct alloc_context *ac, pageblock_nr_pages) continue; =20 - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); for (order =3D 0; order < NR_PAGE_ORDERS; order++) { struct free_area *area =3D &(zone->free_area[order]); unsigned long size; @@ -3516,12 +3515,9 @@ static bool unreserve_highatomic_pageblock(const str= uct alloc_context *ac, * so this should not fail on zone boundaries. */ WARN_ON_ONCE(ret =3D=3D -1); - if (ret > 0) { - spin_unlock_irqrestore(&zone->lock, flags); + if (ret > 0) return ret; - } } - spin_unlock_irqrestore(&zone->lock, flags); } =20 return false; --=20 2.52.0