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 A9B8A32720C; Fri, 27 Feb 2026 16:01:19 +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=1772208081; cv=none; b=URMlDAOZ0zKB2RDBNfa29zVM/4/5Yp3TwBQpy2kNGtEtp2e+6kGVBOY5KvwdbfcW28zWccfjQsnVWNlXvmfG71E4+7i7ncDX6kdc0WQNH4sa7beI39K6fZ0EGtM4thQfbV7/e9OBuX5C0dxoJZpCegRRHRCXHGuEYiNeU7bEuM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772208081; c=relaxed/simple; bh=cOWG1YRjVBiyl6if2qS3/oe6W/VcYdJNd1/MyLz6Ank=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=E8VeTu82keNzgW1yWVC6T6GIE4PotiKbzXh/9ImEzdtg3vIwgSGENUwI8G4Lkur4JGRgwsjxn7BS68tyzEuCzFjW9a7KhvgAcmlpgNDbonrfEYJX67gIk1r0T9S1sm8ETiIzaH13GtoW7yNUNLNKmDD3UVHYynpGbFT/HiMlRQY= 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=OvR8DcUw; 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="OvR8DcUw" Received: from localhost.localdomain (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 9847DB2E32; Fri, 27 Feb 2026 16:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1772208071; bh=UzoB36Gdji3J1eB7hSJEZSO6/0RcFg8v9qSv2IGUJ3k=; h=From:To:Cc:Subject:Date; b=OvR8DcUwEVl2s2n57k8VSZguWeBebBaxFLg1zQpS8GImERtTnvoUro+qg+ZTBybVB gh+IF+emoV8VDF0MbFl39pAuJbpLoFYrIbBkV8oO2NmBac1Ix8X1R+8Kav7ecD7Dhv sBc+1bJ/bbqdp6Gj1VL7zWD3usYXcCP4MZAbgknI= From: Dmitry Ilvokhin To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Axel Rasmussen , Yuanchu Xie , Wei Xu , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Brendan Jackman , Johannes Weiner , Zi Yan , Oscar Salvador , Qi Zheng , Shakeel Butt Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "linux-cxl@vger.kernel.orgkernel-team"@meta.com, Dmitry Ilvokhin Subject: [PATCH v4 0/5] mm: zone lock tracepoint instrumentation Date: Fri, 27 Feb 2026 16:00:22 +0000 Message-ID: X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Zone lock contention can significantly impact allocation and reclaim latency, as it is a central synchronization point in the page allocator and reclaim paths. Improved visibility into its behavior is therefore important for diagnosing performance issues in memory-intensive workloads. On some production workloads at Meta, we have observed noticeable zone lock contention. Deeper analysis of lock holders and waiters is currently difficult with existing instrumentation. While generic lock contention_begin/contention_end tracepoints cover the slow path, they do not provide sufficient visibility into lock hold times. In particular, the lack of a release-side event makes it difficult to identify long lock holders and correlate them with waiters. As a result, distinguishing between short bursts of contention and pathological long hold times requires additional instrumentation. This patch series adds dedicated tracepoint instrumentation to zone lock, following the existing mmap_lock tracing model. The goal is to enable detailed holder/waiter analysis and lock hold time measurements without affecting the fast path when tracing is disabled. The series is structured as follows: 1. Introduce zone lock wrappers. 2. Mechanically convert zone lock users to the wrappers. 3. Convert compaction to use the wrappers (requires minor restructuring of compact_lock_irqsave()). 4. Rename zone->lock to zone->_lock. 5. Add zone lock tracepoints. The tracepoints are added via lightweight inline helpers in the wrappers. When tracing is disabled, the fast path remains unchanged. Changes in v4: - Fix build errors in kernel/power/snapshot.c and mm/shuffle.c files. - Remove EXPORT_SYMBOL(). - Rename header zone_lock.h to mmzone_lock.h. - Properly indent __acquires() annotation. Changes in v3: - Split compact_lock_irqsave() to compact_zone_lock_irqsave() and compact_lruvec_lock_irqsave(). - Rename zone->lock to zone->_lock. Changes in v2: - Move mecanical changes from mm/compaction.c to different commit. - Removed compact_do_zone_trylock() and compact_do_raw_trylock_irqsave(). v1: https://lore.kernel.org/all/cover.1770821420.git.d@ilvokhin.com/ v2: https://lore.kernel.org/all/cover.1772030186.git.d@ilvokhin.com/ v3: https://lore.kernel.org/all/cover.1772129168.git.d@ilvokhin.com/ Dmitry Ilvokhin (5): mm: introduce zone lock wrappers mm: convert zone lock users to wrappers mm: convert compaction to zone lock wrappers mm: rename zone->lock to zone->_lock mm: add tracepoints for zone lock MAINTAINERS | 2 + include/linux/mmzone.h | 7 ++- include/linux/mmzone_lock.h | 100 +++++++++++++++++++++++++++++++ include/trace/events/zone_lock.h | 64 ++++++++++++++++++++ kernel/power/snapshot.c | 5 +- mm/Makefile | 2 +- mm/compaction.c | 58 +++++++++++------- mm/internal.h | 2 +- mm/memory_hotplug.c | 9 +-- mm/mm_init.c | 3 +- mm/page_alloc.c | 89 +++++++++++++-------------- mm/page_isolation.c | 23 +++---- mm/page_owner.c | 2 +- mm/page_reporting.c | 13 ++-- mm/show_mem.c | 5 +- mm/shuffle.c | 9 +-- mm/vmscan.c | 5 +- mm/vmstat.c | 9 +-- mm/zone_lock.c | 28 +++++++++ 19 files changed, 330 insertions(+), 105 deletions(-) create mode 100644 include/linux/mmzone_lock.h create mode 100644 include/trace/events/zone_lock.h create mode 100644 mm/zone_lock.c -- 2.47.3