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 4FE573F2109 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=geWcKTH9JeOIP9LfVoPHHf3RaNepLhNbRPtHRux4Jqldr5HLKvKGAD5GvWNxofkz6Z7rkaJ+NujGmKAD8QkcxU8WLj8E9JaZCC6TIRcx/BdEOt1WHuHBrz9fpmbh/oHTDQD0GCvcE2D3EauNRKgv9Q9HkSCgcyGmABW4KYMAMdo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777464155; c=relaxed/simple; bh=ANkV9bqwkPrN5rMoYai7ELYi5k0bDgC/lY2euIOt+3A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PXYVWLKeh3SQkhxan6BWhbyhZT8u/xeE0ghlUxi786XfIrktpRZ1dYIq2Pbu2D//Rny9+LLGCRplmw7ThfQaUvzXt/tJO5q1jPou7FJqA1jFZZ8quRMASnUhSdItTzwFla3pJloqpZAquz1HYpRdx8nZWtxSNew1MRGVhhFIcjw= 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=rjDRlN12; 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="rjDRlN12" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 45A72C7A79; 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=CIMfHKzu00bESqaVaEzshiKq4od7yyFz/e0DkVUybE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rjDRlN120+b+yTRJyta7epzJ8i8aBzPyf8KjQobRBrimEcy9gpyYEb2/PvFImB5T4 s8UY6eXFGD8UkOHBn4MDFIV4ov0hlnZzIk/Y2+sYR1spgR+9wNiisB4vu8xr90Q98f K3i1XFCN3j8sRKCpDUlcGoKgpRe1DEircd+fiQvo= 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 0/8] mm: use spinlock guards for zone lock Date: Wed, 29 Apr 2026 12:02:05 +0000 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: <13149be4f8151e18eb5f1eb4f3241ab3cffb373e.1777462630.git.d@ilvokhin.com> References: <13149be4f8151e18eb5f1eb4f3241ab3cffb373e.1777462630.git.d@ilvokhin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series uses spinlock guard for zone lock across several mm functions to replace explicit lock/unlock patterns with automatic scope-based cleanup. This simplifies the control flow by removing 'flags' variables, goto labels, and redundant unlock calls. Patches are ordered by decreasing value. The first six patches simplify the control flow by removing gotos, multiple unlock paths, or 'ret' variables. The last two are simpler lock/unlock pair conversions that only remove 'flags' and can be dropped if considered unnecessary churn. Binary size increase is +39 bytes, with Peter Zijlstra's fix for guards [1] applied (already in mm-stable). This is due to the compiler not being able to deduplicate epilogue and eliminate redundant NULL check. See discussion [2] for more details. I proposed a patch [3] that fixes this, but until it is merged we need to assume +39 bytes will stay (though it is compiler dependent). Based on mm-stable. Suggested-by: Steven Rostedt v2 -> v3: - Rebased on top of mm-stable. - Added Acked-by from Michal. v1 -> v2: - Andrew Morton raised concerns about binary size increase in v1. Peter Zijlstra has since fixed the underlying issue in the guards infrastructure in tip [1]. - Rebased on mm-stable, since the patch this series depended on was dropped from mm-new. - Converted guard(zone_lock_irqsave)(zone) to guard(spinlock_irqsave)(&zone->lock). - Dropped redundant braces in unreserve_highatomic_pageblock() (Steven Rostedt) v2 resend: https://lore.kernel.org/all/cover.1775654118.git.d@ilvokhin.com/ v2: https://lore.kernel.org/all/cover.1774627568.git.d@ilvokhin.com/ v1: https://lore.kernel.org/all/cover.1772811429.git.d@ilvokhin.com/ [1]: https://lore.kernel.org/all/20260309164516.GE606826@noisy.programming.kicks-ass.net/ [2]: https://lore.kernel.org/all/afC5C6fylF4AsITV@shell.ilvokhin.com/ [3]: https://lore.kernel.org/all/20260427165037.205337-1-d@ilvokhin.com/ Dmitry Ilvokhin (8): mm: use zone lock guard in reserve_highatomic_pageblock() mm: use zone lock guard in unset_migratetype_isolate() mm: use zone lock guard in unreserve_highatomic_pageblock() mm: use zone lock guard in set_migratetype_isolate() mm: use zone lock guard in take_page_off_buddy() mm: use zone lock guard in put_page_back_buddy() mm: use zone lock guard in free_pcppages_bulk() mm: use zone lock guard in __offline_isolated_pages() mm/page_alloc.c | 53 ++++++++++++----------------------- mm/page_isolation.c | 67 +++++++++++++++++++-------------------------- 2 files changed, 45 insertions(+), 75 deletions(-) -- 2.52.0