From nobody Sat Jun 13 09:16:08 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 3C13C38F233 for ; Wed, 29 Apr 2026 12:02:34 +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=1777464156; cv=none; b=R10W79fc1LzbtbO/PjFgsjKLFQ0y5TjaDwW90LFbYp4OmyE2lmZ/2Z87+qEt88cw/uvBdzjbNq+8WP7YQM2GUfuN55OEjcMZ2UvxRHvW6J5afiI3RCw8pkWeaYewOG5ei/FiS+p0EAlA5jUBEsTMjA1Y7KasYYZmxad9rZWoJcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464156; c=relaxed/simple; bh=xkB4iXHoyqdWDAbpoycqRnyjzvHpdTFsGkIl59h45K8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FGcWBHkuGrsqg7cvLEviWbXhGuJAUDcR+fkvExicnPHYJ2+6FDr7rnQHugNyM0i9icNVAgnE/cDN56FZTZWN2exmYG/C6cPudkYtMfQsofuHqkkC1EHY5Zzz1DjKaKmJDFbObOgGi+sA1fIX8WP9e5s9bK73/q/+bzGn8ILYTks= 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=IuG7wGao; 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="IuG7wGao" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 7E868C7A7C; Wed, 29 Apr 2026 12:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464146; bh=KGNhH3EjUaTQ7/DOs7LxTGRaC2rJZ5LfPVMVIRVko5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IuG7wGaoP3203s1PEB9g4mBAYThzg0IK8w0ePN4DjXVSDldHy5/yUMPqilCoIqo/t 8qfGLF/j1aCUkzQYJEl10NcBI7YI71ARhqPTgOdwwHtaUavcun0Lc+coVlGvN3XZyS EzVboqauIlQOFOA6x0VgHQ1zZmVPbBxAM01w9Ebw= 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 v3 1/8] mm: use zone lock guard in reserve_highatomic_pageblock() Date: Wed, 29 Apr 2026 12:02:06 +0000 Message-ID: <3657e1144e2ffc1ca0eb57d57d89bfec4073d8c6.1777462630.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 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 Acked-by: Michal Hocko --- 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 65e205111553..14c172c9b6c6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3429,7 +3429,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 @@ -3443,29 +3443,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 Sat Jun 13 09:16:08 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 3C22E3A4538 for ; Wed, 29 Apr 2026 12:02:34 +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=1777464155; cv=none; b=DgL77Cx4NFhnxgKZTKoTciygnxCj5iJ2zCW8ZbFcB/148UelwW28n5jGb284EZXP6oj1PN5Ab67gGr+uE1w0fIOK7pLnHRnuAawaTBlVS6RZmI615GyQ405hplv57HUFb4XoWmrbBnbaWIbJbKIMc3v/X6q9X4HH7B9zkJC6RJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464155; c=relaxed/simple; bh=Zs+PL83oNv9HKZFQ6YURArRRCcesSnvNCVPwTDtGH2Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b3s+VJbIC2XtmhO2kaVJsqqys6ao4YSK4IhRzrU3ccPrjnaj/tDWAbIbwn8U4API8UbnBwZf3GCjsFe38GPtZ8cfuY7zuiirSY7Yah5TJzNHDvdbkR16mxjdi8Vblw1Xcjrp49XoeWWOWlHpJR5XDnKb9Ju6ni2h2eMoqjm/J3g= 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=OxcwZUNT; 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="OxcwZUNT" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id B70E0C7A80; Wed, 29 Apr 2026 12:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464146; bh=Twsn80r9MVJjFSVO/LrkxIQo9g3SRn97RPzcuSp3ljU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OxcwZUNThGf9of/51uzvrJuCoHDFTXqLQGk1tOuVjzRSwSJADfPZS6QzSKivX0AlF BcSozBnEnpNhad9j21v2zZNvdA9wIA6/cFMo6byu51s7zIYB1CKx2CvS11r3rGZw57 S6r4ajuoxfTHgPYypleG1+Rj9A3aVZqO87MahRhQ= 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 v3 2/8] mm: use zone lock guard in unset_migratetype_isolate() Date: Wed, 29 Apr 2026 12:02:07 +0000 Message-ID: <815c0905ea77828ed32bf56ff0a6d3c6548eb3a2.1777462630.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 Acked-by: Michal Hocko Acked-by: Zi Yan --- 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 Sat Jun 13 09:16:08 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 5E01A3F54C5 for ; Wed, 29 Apr 2026 12:02:35 +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=1777464156; cv=none; b=GrzF0Wnt3ULRP+0suktNGDPvo1kdsjdhFVx9jZf18hcUUQ8tpC/v210+eDHY1R7n++6St1BqSsDXbcuNoebMDkfSwqU07Z/cZGUBMaj8IadDUOuN3WEwZISsGFsJp6BIShXxVwsnuTrzZFhtwqS3YiqK+Yk6TMZ6arQEDfnGd58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464156; c=relaxed/simple; bh=Pn1H3Nt/0z0jbDuIksxUcp/2y3yIMNEkNvpxL5hNiOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RN80G2qruJiXjKUve6R2R9J9Nr1Vhc8jjSF7QfEYpLME9cVMvMdxBP61LNVxvdN/9b7pvGUmU+s8RbUo2UcbO07AWspCHR09zkPXjVpdFRP817L6ZawZYBZnU5kcUOXMGKrsPhViO0trY19+EdNStFbB/rFx+tV12J1GL2TdfWo= 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=ozdWsuBP; 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="ozdWsuBP" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id EF6EDC7A85; Wed, 29 Apr 2026 12:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464147; bh=+vLfmbXqwXgmH4lNQcVgex9hhUeRXErkE3qPpie0uS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ozdWsuBPqU6Jztn9hhnvmqTTqE6qoUYMX08hLW8Ko9MVXT4TuqfmBruXOi8BvQq8k W6FiDx7J2RQN7vg+XLY+Cs6RcNnwWXimw5jPuaHgZk0/+t/PD5E4LQrD6Ib7YfdPMB dwyBB8iYJTu3MRduuwvRjy4VGDr5BP6fS8vmrqCg= 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 v3 3/8] mm: use zone lock guard in unreserve_highatomic_pageblock() Date: Wed, 29 Apr 2026 12:02:08 +0000 Message-ID: <69db814cd178915cb5615334a29304678f960963.1777462630.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 Acked-by: Michal Hocko --- 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 14c172c9b6c6..2f4170ae60f5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3478,7 +3478,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; @@ -3495,7 +3494,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; @@ -3542,12 +3541,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 Sat Jun 13 09:16:08 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 8FA3A3F7874 for ; Wed, 29 Apr 2026 12:02:36 +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=1777464158; cv=none; b=ZnHxo3/uKC5RsF4s54WdxHARdc3Fh5b+V57QFJDa+nFd42QcQeVMHpXTpbAykWeCNswTNQgxhFvD3etuiS3hR2d1QopBAB7iqTqj+fwGEiEnBH/bA4Zd+Go1f0DWdY8tYt7MLhuxI5Ywdu1BCgRj+yz3Abwuc9zfL3717x377iU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464158; c=relaxed/simple; bh=4joXfnwxpJne1YPL2wc/mT2T4fee+B9Jz5KPI+z/+dg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SudnE4uuxYDyJL+VjW0ehUQruyWCR+yfMC1A6fpvJkDnr60Gsm8SPd5KUvu6vSiUaSf+UBqFV/QA7PhHu3tbj2032lqOjmEaSa2M9gwGTwZreguEdG7SZYhD/rzfDhxAz3iOco2XSSt1zPbc54IKhIjyHgMNnH5wFIGghc80J24= 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=pvdDAmKU; 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="pvdDAmKU" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 32D86C7A88; Wed, 29 Apr 2026 12:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464147; bh=1rMpxXZ2kmfsNrHNEchsSi+oQqPx6tnYYZ6CyNQq+xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pvdDAmKUu/YCvsyoE1HRsKfb/N26oCI7ZJNxFesIJIg8E/1zCqe3TywNd2UGc12XJ +2ljZJlFbPgMk+ub69xTw+lnniU/Liut8L95hOFVXr34L6pHb2lj7hDowDdC9IXjIR lFAFAeJsvKENstEEWyxLWYYsNhcvDfN8AOxi+K+I= 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 v3 4/8] mm: use zone lock guard in set_migratetype_isolate() Date: Wed, 29 Apr 2026 12:02:09 +0000 Message-ID: <6883351ad7f74d20875fff30e0e3214a089cea97.1777462630.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 Acked-by: Michal Hocko Acked-by: Zi Yan --- 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 Sat Jun 13 09:16:08 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 8FB013F7877 for ; Wed, 29 Apr 2026 12:02:36 +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=1777464161; cv=none; b=TVu4iLe2hYQwx6h60h0bbquuDgTM/oA0NTxOfThvtZllF5UY6gon+kxst4NRdfizz4APEXM6Azr11hF6kxFfGx1Ltem3EQdHu+F7iDyXIWX3unnCBShEdlgJh8WFx3iOmatkDQSu4bwxqJ6ZwirADsYh0brQgRGR+Tcm7XRgxTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464161; c=relaxed/simple; bh=S0N6KbmNFQKKnLRMKHmiIauo6kA9Oi22gUGX8XA1h0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=alKSJ1VTrZ5Gjzc2B6pShCvR1riUY+kwuR4h66VlOcRgaRSD5YBxJZcZbc67lpp/hStqn6Kb2QXbzl2YbXkTj67NWc4LTXyWpeaPSTcD4ZHNa/DsXJEEc3qcoN/YrizmLOVKFS9ERT438zlZBhfUit87+AzS1skj3mcC/kTgx+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=Ob03iHLc; 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="Ob03iHLc" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 6C166C7A8B; Wed, 29 Apr 2026 12:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464147; bh=26qgDplv1OVuk6JmQ9HNGeF0qFso0TJsDc0jLQcXRoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ob03iHLccMdBpqwUG6vSr4L4KfbAuFvgGAF30Vcd4N2KBa8r+bWhO8kK+wrRuuc6y pYbmfoOyikSnjfU7JGiLiGi2EGfE5cB1LkjSKLHsogoI+g0VO0kpXjoCwCVEvJt+eP bf1FXLmVuhesdin0ftAVgc0t0ILPvQOEpMBPxS6s= 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 v3 5/8] mm: use zone lock guard in take_page_off_buddy() Date: Wed, 29 Apr 2026 12:02:10 +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 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 Acked-by: Michal Hocko --- 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 2f4170ae60f5..013c97a3db12 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7471,11 +7471,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); @@ -7490,14 +7488,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 Sat Jun 13 09:16:08 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 CED023F7887 for ; Wed, 29 Apr 2026 12:02:36 +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=1777464158; cv=none; b=Nkmx9N6pTLCL1vhCbwkBKvNAzlZ3S4M1ZlRvfpaUWSl+zvieysidjKH78tXnGJl1RyXGsiMfQTvXV7u70NfdneWQC8y7b7mLZF55aF2nx7t1E8Ej0+fWnP0ARcGP/UQiyM5WnR0YL4LP5xVJdG0LQEOYMstB4pZdyUxgebPhW3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464158; c=relaxed/simple; bh=v9DUkxWrF5KmACMPQZdgPJ+zY52hF5ZYYjT5AG0Xsmg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QnOktQ3wAMI1Fpb+YfszCw2XRX4v66IQvBZ4EkSWYoP8ST9dd0A71QYzYspGl9UFDF8iPoWlYVk9j9Inol6YmueePwMndOYDLizNDCbpSYI+Z/6iKepIBr3AYDPVBsOspumIHIP9gawVfONe0bdMShaCLtGOP2nY91ugCPAoVRQ= 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=rgg+jjda; 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="rgg+jjda" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id A820EC7A8F; Wed, 29 Apr 2026 12:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464147; bh=C3AZzXDLPlt3jgnN/vFQBCCKba5l+XEMx11l+vR3eeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rgg+jjdaV6pxhWNX4FZU96fp3XQoxpCe7OhKAPVbuEapxkzF1OiaC55lOelqeKGuu P1C03ncMCwJuh0AHyC2JJ5SrVawASZj798BBWUgpk0IYE8MiMwVlETIz4veJv6sIMi F7GUHcW9dKkw0mnQQjjn2240iVt1c1dQeStc6g7A= 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 v3 6/8] mm: use zone lock guard in put_page_back_buddy() Date: Wed, 29 Apr 2026 12:02:11 +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 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 Acked-by: Michal Hocko --- 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 013c97a3db12..87758fb6a926 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7502,23 +7502,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 Sat Jun 13 09:16:08 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 D99763F54B8 for ; Wed, 29 Apr 2026 12:02:36 +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=1777464158; cv=none; b=h73sJ+tgn5rTq06xCtXZHqf2Do8penV80EGRa4eBPOC7Yn++SPohrYgvKN+4HtEq7apl3jD3/+cJ02BPn7LhpHUZWR40yunjNLIIzUg8d2m52xdfheGWd4z5b6rbf3iLo1BuFCkJLJM7wfRmom0PGjVQ1UfDcNYWbPEQ4jcmltc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464158; c=relaxed/simple; bh=rzOiOlnVMQyOcpUkcztY0NC7FghfDX2xEindS5n4Xcg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VR2tZT9ODjyafTgTmkL/1Uwio5sH4C3X7X3eDuw98/+Vd5k3vHYcgTmZq1G2tBLKtpf7mQUfhEKFGW2LkFL3KLHJy0vwbWR1BzwV7JAWyJvDUP6qGLOCdKOTaui6RTgaQerYYrUACTwJfRMMumLov4YHwwoWMmeItFDLvW6m1zw= 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=RWWSKnaV; 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="RWWSKnaV" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id E1BD2C7A93; Wed, 29 Apr 2026 12:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464148; bh=OOsMll9kQIx755DceTdesDlxlXAn4+aAsGZl7xmkZUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RWWSKnaVu6bg8FfpcCKZGBGlcKbkZMRKYp4JmFsvfHlLEzFE6vh8QL11YDK9kY4+M iwNGLAehc3nQPJgObq4aOVECtGJvEZFODpE22XOAq679VsTRjzQaJXuSWceAl/VVtF 4WbKGP1n+QLIUNpVtc4ftWDPFmPCTK9pveNkzKQY= 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 v3 7/8] mm: use zone lock guard in free_pcppages_bulk() Date: Wed, 29 Apr 2026 12:02:12 +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 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 Acked-by: Michal Hocko --- 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 87758fb6a926..27bd316e4453 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1456,7 +1456,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 @@ -1469,7 +1468,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; @@ -1501,8 +1500,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 Sat Jun 13 09:16:08 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 F31323F7892 for ; Wed, 29 Apr 2026 12:02:36 +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=1777464158; cv=none; b=pBxt4/FE3FX4o2rOn5Cdqe5qN5esfygTmmNtVNtm9lBEalDoCzPwPZ000ENvUKqoDvQaGLromhztr4uOzj2lx1caX/tDC+5d3uL4XEX+6C4unDqRHeLZEUIguYS7qaXroGLwBIr/J1lpIndSnoMYByihb1bAAS6NcT3InQQxC6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464158; c=relaxed/simple; bh=/poa+j1Fvt9M/lrdrjFywY85HrNq4F6FYO291TDYhYI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E4PVxSB9HeOiTCvEsk+i7lr+7tIWm7tmTciThxiENyr01QnC7HatimlZCv05Ilr/BrW4Da1fIYydEJMyUKQ2lfK/C42n2NDR7XA2U+mWujgVAv9WtHiKdbmiJHRD3x62IeHQOzL7UGZQNWU1KeR/cotYKqWkiR3qogz/dQMmmOk= 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=R150X/c2; 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="R150X/c2" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 26659C7A96; Wed, 29 Apr 2026 12:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1777464148; bh=DPNfuYFXh3MO60WD+H/lFLrfvqe7g44VnNFXGNd28pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R150X/c2mqcfSdbvV/5NKOJR6w3c+7naHl79UxHaWjHyWjg9S84FBodt4la+YBEQc e5dQfdkDrap6Ts1dbG1sCOvMCIVwuxpvjNtdlqIC74VNGaU6hYT9EEfJbbJirD3Bpr 9OJFVb8w4VhNsEdA6UzEVgdBmZZ1xJvYY03jBJps= 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 v3 8/8] mm: use zone lock guard in __offline_isolated_pages() Date: Wed, 29 Apr 2026 12:02:13 +0000 Message-ID: <13149be4f8151e18eb5f1eb4f3241ab3cffb373e.1777462630.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 Message-ID: <20260429120213.G7GVxK8Y_kKPGJqulsjeg97mAf0QxwPYOjJ-wWpcEKw@z> 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 Acked-by: Michal Hocko --- 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 27bd316e4453..8cfec846203f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7358,7 +7358,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; @@ -7366,7 +7366,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); /* @@ -7396,7 +7396,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