From nobody Mon Jun 15 06:26:09 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 2BBC83B19CC 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=1775655227; cv=none; b=KCIdprNXMB5KNz2zLAlZFMffeqZ5KuGGu233N1q11VKyNcnz3YBZ+fTQe15hBkSsUTgyvZ42AbXWwn11i0E9LaCZfK1tYtP0OFVShEdFtgj9zbd90u8y1vqG4+tDXUk7+zmh2aD5JacFay5z8eSPK9dNZev1biM3X4dSGn9Bni8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655227; c=relaxed/simple; bh=deugPrvj7XP6nRKhD8+9NMiKZyppDQMXkrUy9D2PUws=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kFvmQf/r/xkPHrIXche8LPZhO4lXree3P49pqn1m2hmkAd4Vv5917WNo5txNmtBUcU6KdW+cW0Y6Q8lu8chUWd3aiZ1fIBeDvutOxsWYAOrdyltJPqKvKhntpHpotkKMKzqlXwBiscadA2ztFNBt46kOiHIhzwBk3BQA1Kcp088= 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=B6CgjiPE; 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="B6CgjiPE" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id DFA7EBE70F; Wed, 08 Apr 2026 13:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1775655219; bh=zCLRAjuTrAQTizeHsvvcGO1levRtnCTOyZrIbtMQ40A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=B6CgjiPEf0oUY+HcHI1TGUkeqsMFfR+z6iwLuuCNGT6xWUh1mPNDAFsbKgfc0z8g0 kctIIZ/mwbnFCIccEJAX9CCMrtczS5vOUz6mniz4QA7JS/H2zTg35B1na/ftX1vy0G BRILKsctNBtNAGDKC44EVtNjzejbgY2r8DJxRNIg= 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 1/8] mm: use zone lock guard in reserve_highatomic_pageblock() Date: Wed, 8 Apr 2026 13:33:16 +0000 Message-ID: <9423598fd4f5664c72c0e030efaef2ac5ceae978.1775654118.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 111b54df8a3c..3a4523c35fb6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3431,7 +3431,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 @@ -3445,29 +3445,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 Mon Jun 15 06:26:09 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 E7853327BFA 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=jZ/jfujOJRpcbUmWea4d78DrNQLLuaA3IC9DJ3e2JGlvTYSmHgCOtA0CY8UsIp6KLS5acmydFZ7rsNwUmtmVQ2JhdT6eUAA6zQ/aJTbmIawj8/v97bvzSY2sLF2UGd/Ylf9IF+cfkUABf+iPecS8wp4hU02y5dWx9zKx5n3oxAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655228; c=relaxed/simple; bh=l+YzA9hNjmXL9xVtURK/zXyTfC2OME24qpma5l9majk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NLpC4npObSj/u6JjsMe5s840uKKOBt7+VZpolwP5WbDcmBM315FxbBfFDr+FEkVYYufbYTBAbLsBYELWeqbSGk/E+Aw/C033MhVknG6Wr+FOhcAacftl5Y7bzOjygU0fhv4gTZz4dw11NJnFbIS2JVuwktva65WFlHAK1QVDeo8= 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=Byro1AdR; 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="Byro1AdR" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 254D6BE713; 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=B7DEJ5+heQ7onPG4SiPavDH/m9STlxrOJvRAAYFCZmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Byro1AdRFmhHNV2ta5mXvcd4QswA/3naGRANsHBhr1wQ28PT8pgLRn035Guuocetb j/svy96Ds3qH6v5rOeF5US4scV2Lovh/Bm4MVhW1hm0CNf8Ckjbx8VF++lezc/nDyw 1c0GRLkhoFbRK3O2fmavL0//C2Y028YHmGIiyb60= 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 2/8] mm: use zone lock guard in unset_migratetype_isolate() Date: Wed, 8 Apr 2026 13:33:17 +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 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 --- 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 Mon Jun 15 06:26:09 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 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: 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 3a4523c35fb6..0b9a423cbd24 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3480,7 +3480,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; @@ -3497,7 +3496,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; @@ -3544,12 +3543,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 Mon Jun 15 06:26:09 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 EFC1D3C9EE8 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=eEaShO+IV+9e6swtPvQImCJFLYjrWXXMRV1T7+kRXwdCBupGjV/K3+uHuQ6RAwaT7ix8RVIcOA36tcupw5epOSjKcSkjif5KmjTlJlficay7u80cO5wjUJFogSS5drgBKJDTRXMIG74IrEs6140XqiTd8xqrOapnPY/56KDXols= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655228; c=relaxed/simple; bh=qDB3n0DefqZEXOgPxw5xItDz7y0w16+JoVG+Y6kvh1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iddwN8WPTsJBMeGf2V/meB++IZ8QD4CcqLK+kmOiSo5ugsFrcO25fDAo2pDrb5TnX66sQvRsftrrQDLKTik03Mb26lLh9+tw4oKInJfxivp05TkbGV6j7cJ6CoEzp3sTITWRMqjLBRYrNYWuq3FkLlLPqIslg83dzJfwSDZfLPo= 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=g1E2+sOR; 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="g1E2+sOR" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 96308BE719; 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=3LpytnOc5QnLYuuG5kgtGtzHAwZXxVYcBS5MJBOR4yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g1E2+sORFrsWyXcMpW/xI3OK8vS/IL7O6mqDUHmGeV4tpEHh854ICn7bayGZmS2B2 65TJbXtCEP/a8dQaSsPWTAa8++gMYq9P+cO6U/Gvjh5sZEz4yhtgMFWeXmCT1Tzzvc 4iqbeo1eTBKBIK5n3keQ1iP3gxD9E7WEjLutBnE4= 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 4/8] mm: use zone lock guard in set_migratetype_isolate() Date: Wed, 8 Apr 2026 13:33:19 +0000 Message-ID: <266d19019bdbfef4b26e7b98e94bb536c6cae398.1775654118.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 --- 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 Mon Jun 15 06:26:09 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 E66473CFF60 for ; Wed, 8 Apr 2026 13:33:48 +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=1775655230; cv=none; b=JLVUHjr6MlqqrG/QB7nOA4TEx8RaS2foJVx8Gxt0DSB0e/p3rkDbMb5Jmv8zn/TQ7TmSUWCJ3PsWoM44nuDIo1/5B4tGL0j+JIMsWJsf+1GrtWq+lBHUI/gmZl2t0eLCJeoK/mEinxir/y61SBvmxwZ/TSP1g20hJeo6BCVz4II= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655230; c=relaxed/simple; bh=U8stkEqy5BeL762byI7pUp2cbDI9iwXdBSvNSIkERxY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XC9sPl4qi+08wL+VMFUPbqdH5yQra8sgkhq3YToVUXZyEG52RmXjEvS7xy4AIfmWth1cgSxerbR3hn8KNTFgCWB2Jdpi1RqNOJBiMKTMhIlF57Pcm3tGXlj2TSW/05BB7Je+Cc71eQuIGBtq6mWt8YjMF07CGioZyIAMnzNMtrU= 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=IvnRXoaO; 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="IvnRXoaO" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id D519EBE71C; 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=1775655220; bh=xTQqRfhvs/Tv/mhxkfDN3528xsH43ydxutA5GLZLSsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IvnRXoaObJirk2iWCAuDUuAZMp8JYZjmXaRXN3rlDRnLU6+WLTt2kcrnFPYJp1V4y PAkcgMOX36lIBxcgF+4Jq1Xz71r4scavVF9rq59QbfDNM4yBABpfvjZjvn+/A20zXY h5HDWLd+rHptqEZJJ5wzYcYACJvJeB3WM9aA1wZg= 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 5/8] mm: use zone lock guard in take_page_off_buddy() Date: Wed, 8 Apr 2026 13:33:20 +0000 Message-ID: <37f14ad134e1e639f4b41c238b14e5a24e9115d5.1775654118.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 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 0b9a423cbd24..4d074707c850 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7509,11 +7509,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); @@ -7528,14 +7526,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 Mon Jun 15 06:26:09 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 E64FC3CFF5F for ; Wed, 8 Apr 2026 13:33:48 +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=1775655230; cv=none; b=WNTIA5J6arEFBb5jEQynPA9K/xAAAAvfWb/S1xPW11HFb1OuilhNV4YWry+L0wEe3q9nTZKJHKrVIM2zirRDHp6fFu6egiiXVEBJ4gtXulmEVRZqNYQy2of/EotdElhmA9r8wmTVhos7XQ6gIjUW+NwEFQ61eImn6WkeM1KV5oI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655230; c=relaxed/simple; bh=MxensvebXpV8CbP+3LL8f6lVUBpa7BGZRUmMydNysZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FYZ30jY3/C77UeJBd+Ff/Z5g0cXnq4R/cYpHTSRqlPtW2Sk/pqFS9mWsemJvBLvg9xJQjJDzSN2rVZ18X+njyLGdhR5ccr/NgzVoxaItXED7oEml1gtysXZENO9HW2Ok734ELJu8JGAQVcIhUh/10rilB/CGR7Njy3hY2lIbViQ= 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=FVkie+Wd; 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="FVkie+Wd" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 25D3FBE721; Wed, 08 Apr 2026 13:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1775655220; bh=e9RL7qlVm+YLvixvcjLOGszgw3jk5/elO9uH+N6Bi7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FVkie+Wdny54lE+/KOfWJvPFtAY/yHO3JfDVQnUuzKlfTwS3xfI8Qd3qUCiavRuzh CldXlyfYRKlKEhz18aWP3UncrQM2riKMZpFVAWv0CwomSkc/KSaVl14R/R9nMNdAqQ Q6/Y9R29lykm1rEbvweJkkdxTnCrGa9Lz84sMgwQ= 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 6/8] mm: use zone lock guard in put_page_back_buddy() Date: Wed, 8 Apr 2026 13:33:21 +0000 Message-ID: <24453163aff5187d34797a879ac89516c2828fd9.1775654118.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 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 4d074707c850..096f5fef0eb5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7540,23 +7540,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 Mon Jun 15 06:26:09 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 9881B3CF042 for ; Wed, 8 Apr 2026 13:33:49 +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=1775655231; cv=none; b=THPivh/hJ/wkjQpMWAY3HkVu3bC6xrgjciqn5J+zQC5UrVMYNHnG+YLC1aWQVKIGCUxE5L6sanC6bQCEvbMJfEJdjYD0XOb1bM3aKODH6rNv6QF4PQiL4EqW2ES4pIy4OfqpaN5+FTl/nohMvxXLBcYf7IBTjBlNKU4epHiN6Wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655231; c=relaxed/simple; bh=hUs6tJZ5TZ3ohW5V7rDFJ6P+6tB/w13xqijUqOPRCRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ci7WyKJoEnPHInkiTyU+Z3ym159h+DjzAPhdHwbfHj6iZcpdngAPEyhYG2iiKBXy28AtWsUnUdg7nFlEJha0Vwdm/kTY7F8wSuFuQ2uXfvgBb0uTfzfbH8+HIIWcRQBw6t6RUFVD9fKK/UKaZR1CCz9NsLmsLKbvge9yM/dSNGg= 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=JNHJhFgp; 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="JNHJhFgp" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 5FFEBBE723; Wed, 08 Apr 2026 13:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1775655220; bh=vb8yz/8C0x2vEUJ8dQHQ8wlORe7yLUnRitFaqcKnbr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JNHJhFgpmQDQ3XbI1JgHGCVwTZ3lfnD7gc7BILslBjP6TLGSLswWUM8MsnW4WzzIX dHkUVcpFX+l3yilRCmFA0kI5mJkuIyKp0rPSiEifAvd61yCwCaET+kobh6LOY1E7I6 cuOkdXLEYQkPOHlirvfQEmSvoDfEkQVRO93jFbHQ= 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 7/8] mm: use zone lock guard in free_pcppages_bulk() Date: Wed, 8 Apr 2026 13:33:22 +0000 Message-ID: <1d51d445a2c4b2c8b7b9d65a86414633a222837c.1775654118.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 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 096f5fef0eb5..6a7c548a7406 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1458,7 +1458,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 @@ -1471,7 +1470,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; @@ -1503,8 +1502,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 Mon Jun 15 06:26:09 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 9890C3D0915 for ; Wed, 8 Apr 2026 13:33:49 +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=1775655231; cv=none; b=PQWJ60x2VFvWVenorQ40lab+DOOKJ8sCrImQFqMWiYuxsl0xX8eqZzZQG+s6R6Vm6UPWt34cdIwyRLVl9Y8S9ZOCGjolF6/oYsAGxFj3rUoh9YlR5T1a4RC9babSQ0lB2tg8oFT32kXzc3BNfwuKRrnNkmzNzsyXU+hhN7zs0bE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775655231; c=relaxed/simple; bh=+1p1TxuwHOE3Ysv1F5HtSBzdCmr5mDn0Y72mGPWBS/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fRkLui5E7K6x6nHCxJlCdo18p8wMSPXeKj2Pwmxp3S5eox/Sln4J4xQICqi3mFPkwkf8GiADr+W9uvebW/Ug1iNbvQZGbLyiCU6DIUX/mWQDsK4R8HwjSzcaxlwTLFRliyBccPYGgXI7EUV9BpvXMIvofO2cCXPYOWL+MwTBWjg= 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=bhtlSTwf; 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="bhtlSTwf" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 9AC46BE727; Wed, 08 Apr 2026 13:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1775655220; bh=nf+JuPEE/jp8A+2PdYP2O6YgayTSpGEteEGx3VKZEwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bhtlSTwflFyzIun/pkj53UHMDknnPfyBwaNmJiJdop/TjpXEBE47MclZwzdhTxbrn kX3SRbMi/dWR6jXgz8zlaWNT8y2hN8fANknXtgLvypFaiWel8Of/YBaT/aioCaU57f ly8rOQKQsKo5nA2Te4SI6Q/ESxwJBcUEBU8iwpVc= 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 8/8] mm: use zone lock guard in __offline_isolated_pages() Date: Wed, 8 Apr 2026 13:33:23 +0000 Message-ID: <0da769d4078fccbde4182a5ee655ea673ccbd5a9.1775654118.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 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 6a7c548a7406..bda0282bcb03 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7396,7 +7396,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; @@ -7404,7 +7404,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); /* @@ -7434,7 +7434,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