From nobody Thu Apr 2 17:17:17 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