From nobody Thu Apr 2 15:35:59 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 3AFF7346E75 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=HjgMPy/6HUZZSayb0AqzaQtEOHkifibKuo1nUan8HNldZDY0D/QqOriTUJEsGug6e2j39NkziwUrhQ++wiSFAkUneQsWZRmgdhzFuzSKznPCYs/M2UDpeTw3r2/xORolijItjh0Sc3KbfbcTjEKxcY3A2KxXtQC72uzm7i/bpb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628115; c=relaxed/simple; bh=xh7qVUQBAAyFUrIjvVpM4UCdGklJOKkWumk3kTo11TU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LuTf7ZP3U9YnsirWcGJzvG5eayjposO7OnNMtx/eSe+8ycVhTbOGWS7IVhKaXqNhWYfU4m5x2Ko+buZozt/QI4/Qu5y1LCWfFu3kz14zyUsw+4rdfKjB97SR6G4mNi8faXPGhMd+8aT4Xdo+MWHnq3jV6ItG1kiRcgMDfNNyK00= 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=wyYmjHEH; 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="wyYmjHEH" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id E14CFBDFF0; Fri, 27 Mar 2026 16:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1774628106; bh=YEgctjadaPC6e1ht8UPND33GBVnpMY+JzCTIORsmJW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wyYmjHEHeoLQV080hjixwgktMwryHxpYFkRCh2fkkH8E0djeIfdN8d/BPOEbFwwOn IkobkraGWdidDzVni9+VfV1Om7zCe/jcHo4dF68x3hXOdlMeWr//qwWNbgayNjJh+O XRv5p5gqJti/XTbKxBFkA5/76AR7WrKmGVTdKxTI= 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 1/8] mm: use zone lock guard in reserve_highatomic_pageblock() Date: Fri, 27 Mar 2026 16:14:41 +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 the spinlock_irqsave zone lock guard in reserve_highatomic_pageblock() to replace the explicit lock/unlock and goto out_unlock pattern with automatic scope-based cleanup. Suggested-by: Steven Rostedt Signed-off-by: Dmitry Ilvokhin --- mm/page_alloc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f11f38ba2e12..c7b9b82b5956 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3403,7 +3403,7 @@ static void reserve_highatomic_pageblock(struct page = *page, int order, struct zone *zone) { int mt; - unsigned long max_managed, flags; + unsigned long max_managed; =20 /* * The number reserved as: minimum is 1 pageblock, maximum is @@ -3417,29 +3417,26 @@ static void reserve_highatomic_pageblock(struct pag= e *page, int order, if (zone->nr_reserved_highatomic >=3D max_managed) return; =20 - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); =20 /* Recheck the nr_reserved_highatomic limit under the lock */ if (zone->nr_reserved_highatomic >=3D max_managed) - goto out_unlock; + return; =20 /* Yoink! */ mt =3D get_pageblock_migratetype(page); /* Only reserve normal pageblocks (i.e., they can merge with others) */ if (!migratetype_is_mergeable(mt)) - goto out_unlock; + return; =20 if (order < pageblock_order) { if (move_freepages_block(zone, page, mt, MIGRATE_HIGHATOMIC) =3D=3D -1) - goto out_unlock; + return; zone->nr_reserved_highatomic +=3D pageblock_nr_pages; } else { change_pageblock_range(page, order, MIGRATE_HIGHATOMIC); zone->nr_reserved_highatomic +=3D 1 << order; } - -out_unlock: - spin_unlock_irqrestore(&zone->lock, flags); } =20 /* --=20 2.52.0 From nobody Thu Apr 2 15:35:59 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 01F0D347530 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=Qr8IwnGrcU4Vwr0JMLZHZDxI0dWNHtcEWZiAqLIva7hjgCuhnMOvMKu5Q/6XpzRCruWhFn9zJgcKk/Ecb2poIl77U2NGegj4ibc7UC3z6Mne9PwHI+NG7r+v6Scg+G1SmkcH95YPMapwvyDjb9Pmmx1DIDzys953FH3AVPl3wOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628115; c=relaxed/simple; bh=l+YzA9hNjmXL9xVtURK/zXyTfC2OME24qpma5l9majk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OnBc1DdeJwXiChah9L2kKASeHY6lxAZ/b0eo+ptFN/GgDryIdwUzTRDUV4jk64dRMt8EqtvvYVM03XWd+PC9N4uOqdnfaR1F7BQRtzNCts8tJqWlOaWeBTtraJwkSGTCPEI0BNR5O7SmIo5LJI6VnXbkWXSp5HRN+Rd5Sv2ZVuY= 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=rFprX9/c; 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="rFprX9/c" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 2BFB9BDFF4; 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=B7DEJ5+heQ7onPG4SiPavDH/m9STlxrOJvRAAYFCZmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rFprX9/czIYpk1hi0PDIfJiYr9UDmrn01At0JPcx6PnxMzpApE1TGZp1DomGrZmq8 rkaNNNgC5R/FeDXomkyq1NQwRqI4xe/bYuOddaYm7vF7qdIyHiA7wtt3v685+c3Orr /fKUPCEXglEytJEC6VCrWP6ng0RQfMukdSMt5h5Y= 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 2/8] mm: use zone lock guard in unset_migratetype_isolate() Date: Fri, 27 Mar 2026 16:14:42 +0000 Message-ID: <7a35dde707776916c170c26f9124644228d346ce.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 unset_migratetype_isolate() to replace the explicit lock/unlock and goto pattern with automatic scope-based cleanup. Suggested-by: Steven Rostedt Signed-off-by: Dmitry Ilvokhin --- mm/page_isolation.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index c48ff5c00244..9d606052dd80 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -223,15 +223,14 @@ static int set_migratetype_isolate(struct page *page,= enum pb_isolate_mode mode, static void unset_migratetype_isolate(struct page *page) { struct zone *zone; - unsigned long flags; bool isolated_page =3D false; unsigned int order; struct page *buddy; =20 zone =3D page_zone(page); - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); if (!is_migrate_isolate_page(page)) - goto out; + return; =20 /* * Because freepage with more than pageblock_order on isolated @@ -279,8 +278,6 @@ static void unset_migratetype_isolate(struct page *page) __putback_isolated_page(page, order, get_pageblock_migratetype(page)); } zone->nr_isolate_pageblock--; -out: - spin_unlock_irqrestore(&zone->lock, flags); } =20 static inline struct page * --=20 2.52.0 From nobody Thu Apr 2 15:35:59 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 From nobody Thu Apr 2 15:35:59 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 01F8E347539 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=czOsUV3yOGn+6uhywKys8depdD1io9gnUGRMI1hV/i8diSBvrlazQAk2LoG4wPAtJeFTOI6eEWGNb8Kca4JqMZsnaB9dMicwyP7PAFUZi0Ed3ofi20B3ih+pLcouXMwNNuHpUXMKbZ5fcFvVq87YP+Ds+amteWrhtBO6KWajxZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628115; c=relaxed/simple; bh=qDB3n0DefqZEXOgPxw5xItDz7y0w16+JoVG+Y6kvh1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GEm7BUu6iDqM9NvNq1WsOhFuQnd554waK0Cn6Ngm9hG9a+MnW+bdcJdFJ6LFrn+ARTKHjBUA0ZHHRKLhi4XM3febZYuJS7KLs/wwwGhnN6cB505fu9CWykg2NvVlR16R4omQd625ApBKMKubcFFXGzwOVRofwn+sYqD/L8UpNUk= 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=emO7SczW; 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="emO7SczW" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id A93BBBDFFC; 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=3LpytnOc5QnLYuuG5kgtGtzHAwZXxVYcBS5MJBOR4yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=emO7SczW8t/0nVeRik7ewArnH8FGmtAuYwyu6Nq69WiY29mHcbRKWx1iBuBmwEnEv uRZTERD4v1Vr89VdVX4yzVQ47pXOK3NDR5VbpbCG2bJ+kgY0hW8EnmlndY3iH8p6Mv pNrDcraxnpxxrLoUDfdp0QkwJNIavds/QsR/jx4I= 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 4/8] mm: use zone lock guard in set_migratetype_isolate() Date: Fri, 27 Mar 2026 16:14:44 +0000 Message-ID: <80377691336ce978dbfcac17ebaa6de9837a0b8f.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 scoped lock guard in set_migratetype_isolate() to replace the explicit lock/unlock pattern with automatic scope-based cleanup. The scoped variant is used to keep dump_page() outside the locked section to avoid a lockdep splat. Suggested-by: Steven Rostedt Signed-off-by: Dmitry Ilvokhin --- mm/page_isolation.c | 60 ++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 9d606052dd80..7a9d631945a3 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -167,48 +167,40 @@ static int set_migratetype_isolate(struct page *page,= enum pb_isolate_mode mode, { struct zone *zone =3D page_zone(page); struct page *unmovable; - unsigned long flags; unsigned long check_unmovable_start, check_unmovable_end; =20 if (PageUnaccepted(page)) accept_page(page); =20 - spin_lock_irqsave(&zone->lock, flags); - - /* - * We assume the caller intended to SET migrate type to isolate. - * If it is already set, then someone else must have raced and - * set it before us. - */ - if (is_migrate_isolate_page(page)) { - spin_unlock_irqrestore(&zone->lock, flags); - return -EBUSY; - } - - /* - * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. - * We just check MOVABLE pages. - * - * Pass the intersection of [start_pfn, end_pfn) and the page's pageblock - * to avoid redundant checks. - */ - check_unmovable_start =3D max(page_to_pfn(page), start_pfn); - check_unmovable_end =3D min(pageblock_end_pfn(page_to_pfn(page)), - end_pfn); - - unmovable =3D has_unmovable_pages(check_unmovable_start, check_unmovable_= end, - mode); - if (!unmovable) { - if (!pageblock_isolate_and_move_free_pages(zone, page)) { - spin_unlock_irqrestore(&zone->lock, flags); + scoped_guard(spinlock_irqsave, &zone->lock) { + /* + * We assume the caller intended to SET migrate type to + * isolate. If it is already set, then someone else must have + * raced and set it before us. + */ + if (is_migrate_isolate_page(page)) return -EBUSY; + + /* + * FIXME: Now, memory hotplug doesn't call shrink_slab() by + * itself. We just check MOVABLE pages. + * + * Pass the intersection of [start_pfn, end_pfn) and the page's + * pageblock to avoid redundant checks. + */ + check_unmovable_start =3D max(page_to_pfn(page), start_pfn); + check_unmovable_end =3D min(pageblock_end_pfn(page_to_pfn(page)), + end_pfn); + + unmovable =3D has_unmovable_pages(check_unmovable_start, + check_unmovable_end, mode); + if (!unmovable) { + if (!pageblock_isolate_and_move_free_pages(zone, page)) + return -EBUSY; + zone->nr_isolate_pageblock++; + return 0; } - zone->nr_isolate_pageblock++; - spin_unlock_irqrestore(&zone->lock, flags); - return 0; } - - spin_unlock_irqrestore(&zone->lock, flags); if (mode =3D=3D PB_ISOLATE_MODE_MEM_OFFLINE) { /* * printk() with zone->lock held will likely trigger a --=20 2.52.0 From nobody Thu Apr 2 15:35:59 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 E71F834B186 for ; Fri, 27 Mar 2026 16:15:15 +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=1774628117; cv=none; b=j3ktOm6MnD828ShPctugn6eXYn9FlkUGfxPddKHOwxXN987e/EysnjVQar5oNhBm4YQUSmGka/kv/HlL1dhfU+JGW4VJFMNmhnHjImZRTRujz+L+CEnhgmvsrsk+GFlmT6k3QRoG1iEHPWX7xtFa4s6Rd4QImsI3JeGjfq498yM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628117; c=relaxed/simple; bh=5xho3O5B6nJ8PvcmJTH4aQ4EWFcI0pzhUw8xh0YvCzo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u7sVSAcHTBmT8eZGGco0QMjfDcpuavOMbj2qhAmBDKMaD05XEpIXwA9kpg9A1+M8L7mf8fb7Xvm76rDynCBUP2RBmKysMbvYnxs9pcvG96+vFiq/ZfkAalCQAHPNd0eOhc5kcxNDCVRdwzhiVm+Cmeeqqzn6+pp6tMZrVjuL4i8= 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=gkjmX8xQ; 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="gkjmX8xQ" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id ECBD6BDFFE; 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=1774628107; bh=XCId2zbix+QCFEZnLdcQLxRLUHjV8l04CxkNFJM13pM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gkjmX8xQkBKFXycL5JAS21V0pRqS8HUCoMN2sUOGhAQQxV04kJzsO/ohT4zsQuunl NmHvf6ni91o8J5lsA5bY9BPjuPE/y9UZFUP8Si/QeuuJq9Eo40B4uBSB2qvca9OWqZ 3jB2V4Aor8GvVmNs4pwBnzOoraJG24cDjvN4kyeo= 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 5/8] mm: use zone lock guard in take_page_off_buddy() Date: Fri, 27 Mar 2026 16:14:45 +0000 Message-ID: <79d3acf242a3a56e55c6cacd60698f427292621d.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 take_page_off_buddy() to replace the explicit lock/unlock pattern with automatic scope-based cleanup. This also allows to return directly from the loop, removing the 'ret' variable. Suggested-by: Steven Rostedt Signed-off-by: Dmitry Ilvokhin --- mm/page_alloc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f06d8b5ffc88..a124e4eebda4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7488,11 +7488,9 @@ bool take_page_off_buddy(struct page *page) { struct zone *zone =3D page_zone(page); unsigned long pfn =3D page_to_pfn(page); - unsigned long flags; unsigned int order; - bool ret =3D false; =20 - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); for (order =3D 0; order < NR_PAGE_ORDERS; order++) { struct page *page_head =3D page - (pfn & ((1 << order) - 1)); int page_order =3D buddy_order(page_head); @@ -7507,14 +7505,12 @@ bool take_page_off_buddy(struct page *page) break_down_buddy_pages(zone, page_head, page, 0, page_order, migratetype); SetPageHWPoisonTakenOff(page); - ret =3D true; - break; + return true; } if (page_count(page_head) > 0) break; } - spin_unlock_irqrestore(&zone->lock, flags); - return ret; + return false; } =20 /* --=20 2.52.0 From nobody Thu Apr 2 15:35:59 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 E72A134B191 for ; Fri, 27 Mar 2026 16:15:15 +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=QsoDnvMAGWDVim2IA8AVQa+o1fhdorsZfvNCkGnZFj0aICZRNfls1PKrXCmtEfaRTrVsmQLPicvnIDWvPDRSPptKtzsSakrGVKl1EIq+yHYy7RLFJbuDZIhESWTHyAbfaEtKdW83HjBl051RJtt2Jo7L8XCXx21TlmoVIa02MFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628118; c=relaxed/simple; bh=r3Vw9o/WtMzfNPiv9ETNjj8oUtjDklIrBU1BS23UqPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LNysIR1UJwRyRyOtRAGJALGN48m9PvovbfAvGs8uorQVnlKZtZ/6AdWf4/MR9pfOzWK5QOmbWV06VJY7rV1AU/qVnnbKvi0MSLUnCGI7vMi+sHR3xXO9KT2t+anyFlOds0JhJrgClbpYK5XWmouHhFGuHM1xS9R2egf/Arfsqiw= 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=JQ+Y2zVT; 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="JQ+Y2zVT" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 35EE5BE002; 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=Z9Gu9mdbn4w3OqiiQpAxHR+GJdxY31abyFRKRvHJHmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JQ+Y2zVT21zzVsEdJDO6n9/TzQL8kdbVKmhbkqMNdtsDuCfRIsmAclilW8PALhluk o21YSxJFVe8VoUBxrxbgKOqVsbjvkBmvo1oenJJ3l3N7oRaMagkmPzJW4cPURQHKV1 lh98lNTv9xmPXEsr6HbHW5ho8Va4S1fnvVJNhv6w= 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 6/8] mm: use zone lock guard in put_page_back_buddy() Date: Fri, 27 Mar 2026 16:14:46 +0000 Message-ID: <1a4085f7ed0adee75bd09b683cf50e612222c8a4.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 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 a124e4eebda4..dd13aa197456 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7519,23 +7519,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 - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); 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; } - spin_unlock_irqrestore(&zone->lock, flags); =20 - return ret; + return false; } #endif =20 --=20 2.52.0 From nobody Thu Apr 2 15:35:59 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 9705F34F495 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=EYyAGKXT43Rfgnl+TdLPsKDTFTjNN3af3PHYc8EgA0xD1Fns6WJLRxrTnWg0SHluCIk1FbolJcQgBrxZoH69JV/B8YBDsxh3ZnCVlFoWFGrvoxiNkDUdhpd3k8l3NxrmKE7os/pFybEHpC7zABUesYJxKJJnVNpqQiWdQ0EUGiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774628118; c=relaxed/simple; bh=LKqZHvPTCXKuG0lmbfYLwifZOW0m2aPvE909EUfIqvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E+VklU2G+63E3YlHmj7G7bApONIjf4DckSQzkmG9/nVttjNWvuw5+j2riKcpPPcqOslIPrPwqmKlth3022Vbz0ppfoBqD3/fsnDK7dk/txUAFRaXCgYNAhLH1d8mnEOrxkY+J6Cb53nxzAwdN/mW33iHAzRA0f+Yz98bGUTDWjI= 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=kIiNtB4I; 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="kIiNtB4I" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 790D6BE004; 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=0umBsNKXjUK+2hAq+sat8jSohQzLE1gjCa1ANMaQOpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kIiNtB4IPEFvaZh1DBfYaGhPicuKMcH2DZ4M+yTw0SEFwD8mZEQK6juz4PSOLInFq dqQY8DG1kj0mi4YHSmk0th8NR+MEDyQnOPYrQfPCw3GKk/JuhNEiF0QKb0xhxGYI6W LBk7Of9R8uGEyY0BNdFv8ZnmgY3I5fNXicz+QMYw= 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 7/8] mm: use zone lock guard in free_pcppages_bulk() Date: Fri, 27 Mar 2026 16:14:47 +0000 Message-ID: <8483097be6fd28943400e11cf498d360110419c2.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 free_pcppages_bulk() 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, 1 insertion(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index dd13aa197456..b00707433898 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1451,7 +1451,6 @@ static void free_pcppages_bulk(struct zone *zone, int= count, struct per_cpu_pages *pcp, int pindex) { - unsigned long flags; unsigned int order; struct page *page; =20 @@ -1464,7 +1463,7 @@ static void free_pcppages_bulk(struct zone *zone, int= count, /* Ensure requested pindex is drained first. */ pindex =3D pindex - 1; =20 - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); =20 while (count > 0) { struct list_head *list; @@ -1496,8 +1495,6 @@ static void free_pcppages_bulk(struct zone *zone, int= count, trace_mm_page_pcpu_drain(page, order, mt); } while (count > 0 && !list_empty(list)); } - - spin_unlock_irqrestore(&zone->lock, flags); } =20 /* Split a multi-block free page into its individual pageblocks. */ --=20 2.52.0 From nobody Thu Apr 2 15:35:59 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