From nobody Thu Apr 2 17:10:50 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 9713634F49C for ; Fri, 27 Mar 2026 16:15:16 +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=1774628118; cv=none; b=dnGIbnkRW5EPjnMf+uLTuHzQYMuGh09grnue443Ext2CMkg+OZ0aDcefVnRRuzDCWuyezgxThkpL2wmBo5VNr/QH9ZEaLELQhYYbZmXaDR6t+odyfstKok4Sq8f/ncVzpgAZcDHo3MxsQ2xqdq0pWxHPYZWhsUgipdaRQpiG31s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628118; c=relaxed/simple; bh=6UDPxKdH9kqYkZVZIah2zfChchGbLsq24BgCM2WdPHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tKoabHd+0Ni7npU57Uictl/hM8Xet9++bl0AHMsrzOrW30hwjsrVqQ4fbtqGqPyWoxCn+o8i3rGb7kWiwAzngAgGj/+pTjmUNI8IcCw4NZFVecb03Q8aMifzlEtCP6he2doRwc3adczL4OtP46yBFBlc5bqBbigZZjFkLJ/Po+c= 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=xKidylPY; 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="xKidylPY" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id B7AC4BE009; Fri, 27 Mar 2026 16:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1774628107; bh=fc1DSdx+1NGpsx6DxTUmGYyzLhousydXBN7+P9M33vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xKidylPYRrg81a+LWdvitx5WGKoZmgJNywFEWcboptqVf1GBb2Sb/+E6ZHh/sfmiy 6fB6qIH3UyK9DVvjuxxeDjiNMMja+GNJBVlFUy7viezxSQn0skOFkARbveVS96KqQJ 6Ea57l3JeVdeeUgUwClPeVXubOyqbejjG5RTYPJc= 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 8/8] mm: use zone lock guard in __offline_isolated_pages() Date: Fri, 27 Mar 2026 16:14:48 +0000 Message-ID: <894e4e6ab3a581ccb43bcfa4c2b7c1c38e1193c3.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 __offline_isolated_pages() 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b00707433898..6a679995b9df 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7375,7 +7375,7 @@ void zone_pcp_reset(struct zone *zone) unsigned long __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) { - unsigned long already_offline =3D 0, flags; + unsigned long already_offline =3D 0; unsigned long pfn =3D start_pfn; struct page *page; struct zone *zone; @@ -7383,7 +7383,7 @@ unsigned long __offline_isolated_pages(unsigned long = start_pfn, =20 offline_mem_sections(pfn, end_pfn); zone =3D page_zone(pfn_to_page(pfn)); - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); while (pfn < end_pfn) { page =3D pfn_to_page(pfn); /* @@ -7413,7 +7413,6 @@ unsigned long __offline_isolated_pages(unsigned long = start_pfn, del_page_from_free_list(page, zone, order, MIGRATE_ISOLATE); pfn +=3D (1 << order); } - spin_unlock_irqrestore(&zone->lock, flags); =20 return end_pfn - start_pfn - already_offline; } --=20 2.52.0