From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit 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 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; @@ -1471,7 +1470,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, /* Ensure requested pindex is drained first. */ pindex = pindex - 1; - spin_lock_irqsave(&zone->lock, flags); + guard(spinlock_irqsave)(&zone->lock); 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); } /* Split a multi-block free page into its individual pageblocks. */ -- 2.52.0