From mboxrd@z Thu Jan 1 00:00:00 1970 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 E8CC23B8D78 for ; Wed, 8 Apr 2026 13:33:46 +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=1775655228; cv=none; b=VQ5+TlZVuuuoQBB71Q/PvWx4sJvyLmeaqGS3PFu46XiIIquKmfhOq9t7ZhEJ6LyCJpyQWxuytxPB4vA7++SKpZMKc7KZGFmTAJ88hj05hhnPliPVhABoNsYEk+ITVjhgsu5PHg+vdCOooJRqr2NshQ1o64jv2CM/VIOiMA8dBOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655228; c=relaxed/simple; bh=uf6/yxFw0YzzcfnWuqExXAy05B58BjPtAllquplEAD0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kt4wClDJKh5CU0lsyZZJVxiqpwBaf1Rcvl7PlEC9HXnjGhsy+9EjAVlveiRm1kQQ8MfqJ8xg35IblASO7s6E1eMZmDABi+yTB1PTVd/qJGhGyb1XLWidPakqQbBQ3Gwgfpx1A6psvemB2H5C3DCN4qrRKFAv4L9YCL2YUpYZHA0= 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=2pjpuHjT; 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="2pjpuHjT" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 5E8CABE716; Wed, 08 Apr 2026 13:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1775655219; bh=nEzTFQjl9DqVOjuj8AZ7Q8vKfFlTMogz1GqqT4a5JQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2pjpuHjTz5McVfzUin/beRPpMqPNX2JPb9m5gwSLojZPjhvqhu3AEtJoafxeecmR9 CJD7wS5ddB9R/2JhNy4jkxLi2OTX2JC5aTkzW2DSb29rdiPE7apXSwA+mBIeHaplFv 3s8KAFlG2qZHJmIKZLN4f/hcAHsvxWVHDwp32lWg= 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: [RESEND PATCH v2 3/8] mm: use zone lock guard in unreserve_highatomic_pageblock() Date: Wed, 8 Apr 2026 13:33:18 +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: 8bit 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 3a4523c35fb6..0b9a423cbd24 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3480,7 +3480,6 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac, bool force) { struct zonelist *zonelist = ac->zonelist; - unsigned long flags; struct zoneref *z; struct zone *zone; struct page *page; @@ -3497,7 +3496,7 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac, pageblock_nr_pages) continue; - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); for (order = 0; order < NR_PAGE_ORDERS; order++) { struct free_area *area = &(zone->free_area[order]); unsigned long size; @@ -3544,12 +3543,9 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac, * so this should not fail on zone boundaries. */ WARN_ON_ONCE(ret == -1); - if (ret > 0) { - spin_unlock_irqrestore(&zone->lock, flags); + if (ret > 0) return ret; - } } - spin_unlock_irqrestore(&zone->lock, flags); } return false; -- 2.52.0