From nobody Fri Sep 25 08:45:38 2026 Received: from mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12E2F368941 for ; Tue, 15 Sep 2026 02:43:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789440225; cv=none; b=rDuX/e1iFEiR3O/diB32rlB9J8Jbo/Tf09tYNGDvdld+UR3Bayi0TldO+rNmPSR9d7Ewt55SUU3byn2heM/0lval4Wy8ic/GM28FsoL2yRdcUyf1HhiYWhIrODgr8eUgTKlsqOQz4Fb+BhYYqAgisb7uZERlGylIxN78a4K8doM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789440225; c=relaxed/simple; bh=DtVe6iy9kJQc88TiAutYrREK+boNgH17VbBNJY5qxyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fBax+P/2rPwvRIlLdTaF/ybwqxk72gAUXtPwH35DMvgxo6xI6zA+zEsYJQKtvlX7L7vMwQZWlqriOyjDfGr8L9Rs40O3gjkXaDepYt9bzsS5Ys3aD0Jp4c3t0fGxgj8ek4HHVCiLTFuhG3Ia4HVcTN9VkJpswW0s7Vylk/HgOYg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=V/FRTSn2; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="V/FRTSn2" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=DtVe6iy9kJQc88TiAutYrREK+boNgH17VbBNJY5qxyE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789440220; v=1; x=1790045020; b=V/FRTSn29A+j4slc/1Ay3rzTNl4t8TUj6+J4EA/vBC7DZI3xgaD8hESrGTOk2lwwNZ33rG5/ MWeWMgB9Ldw36xftIrZig9Rbl7Y3NRzVof2s0r3q6MsWQzJiXoqMHJyGdRoKZltGT3gveWDyYmN KgwXNMjrZJgYZ0M/i6D3Il0A= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 17f25854bac11652; Tue, 15 Sep 2026 02:43:40 +0000 X-Mizu-Trace-ID: 17f25854bac11652 X-Migadu-Flow: FLOW_OUT From: Ye Liu Date: Tue, 15 Sep 2026 10:43:30 +0800 Subject: [PATCH v2 1/3] mm/vmalloc: group xa_init with vbq field initializations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260915-vmalloc_study-v2-1-cc4dfe635e22@linux.dev> References: <20260915-vmalloc_study-v2-0-cc4dfe635e22@linux.dev> In-Reply-To: <20260915-vmalloc_study-v2-0-cc4dfe635e22@linux.dev> To: Andrew Morton , Uladzislau Rezki Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu X-Mailer: b4 0.14.3 From: Ye Liu Move xa_init() next to the other vbq field initializations instead of after the unrelated vfree_deferred setup. Signed-off-by: Ye Liu Reviewed-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 859e6d2d57a3..117483dd048c 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5585,10 +5585,11 @@ void __init vmalloc_init(void) vbq =3D &per_cpu(vmap_block_queue, i); spin_lock_init(&vbq->lock); INIT_LIST_HEAD(&vbq->free); + xa_init(&vbq->vmap_blocks); + p =3D &per_cpu(vfree_deferred, i); init_llist_head(&p->list); INIT_WORK(&p->wq, delayed_vfree_work); - xa_init(&vbq->vmap_blocks); } =20 /* --=20 2.25.1 From nobody Fri Sep 25 08:45:38 2026 Received: from mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 003CB3D0900 for ; Tue, 15 Sep 2026 02:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789440226; cv=none; b=bk2ZVTCt17RsbpN6mey6aJwu9DFkkv355Cyts/63Ryj8yyKOdRLfuDzjJTMp33fDx4VLXORZlid5oGKuuOv8JlUIvzdNP+FrfV1S1M1bcxqPrU52f5Y/SyjyMk/WkYtx7HQ2WHC/PkaxNaBG/zIG8ZwyqB6KIhY/AzhGrsb5vR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789440226; c=relaxed/simple; bh=F73hVyZvf0eZtl+4VEeziRhY9hxVXl8gY1uJk53dZ98=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V8L89lXQgWd9c9UORgsC/zTvHsrZdhhR5lxLavep+OLA+y3zuFskWNwvX05WmnghtuQe+aEbxI00Nt/zQFr4BChtlloKWgz6Pk+Y5hBRoi0G5TGf8GYBxptcFNbfPCQICzrFw6zX69N7s21jhjhtbN/edsgUwdCGRuniQIiSN4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mKk2zpXv; arc=none smtp.client-ip=91.218.175.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mKk2zpXv" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=F73hVyZvf0eZtl+4VEeziRhY9hxVXl8gY1uJk53dZ98=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789440221; v=1; x=1790045021; b=mKk2zpXvRBnrjD76Y/5amv0teeUuJoz+PwTU4C8VIur3dzy8xHK8+2JAYAU4xWwhbzB0CuZM 5z5U1WSiIDQgE/ueU3vXJMUd23yglqZnvbOzagLri/nu3GFZie9JPV2BHE21VBWuF32CcJKIeYR aXVPqXhZ7bCtIgEuIdzPAsaY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id a551f472497e0f01; Tue, 15 Sep 2026 02:43:41 +0000 X-Mizu-Trace-ID: a551f472497e0f01 X-Migadu-Flow: FLOW_OUT From: Ye Liu Date: Tue, 15 Sep 2026 10:43:31 +0800 Subject: [PATCH v2 2/3] mm/vmalloc: extract vmap_insert_free_area helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260915-vmalloc_study-v2-2-cc4dfe635e22@linux.dev> References: <20260915-vmalloc_study-v2-0-cc4dfe635e22@linux.dev> In-Reply-To: <20260915-vmalloc_study-v2-0-cc4dfe635e22@linux.dev> To: Andrew Morton , Uladzislau Rezki Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu X-Mailer: b4 0.14.3 From: Ye Liu The allocation and insertion of a free vmap_area is duplicated between the loop body and the tail of vmap_init_free_space. Factor it into a small helper so the main function only deals with computing the free gaps between busy regions. Signed-off-by: Ye Liu Reviewed-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 117483dd048c..973d15ef4f3e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5433,11 +5433,23 @@ module_init(proc_vmalloc_init); =20 #endif =20 +static void __init vmap_insert_free_area(unsigned long start, unsigned lon= g end) +{ + struct vmap_area *free =3D kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT= ); + + if (!WARN_ON_ONCE(!free)) { + free->va_start =3D start; + free->va_end =3D end; + insert_vmap_area_augment(free, NULL, + &free_vmap_area_root, + &free_vmap_area_list); + } +} + static void __init vmap_init_free_space(void) { unsigned long vmap_start =3D 1; const unsigned long vmap_end =3D ULONG_MAX; - struct vmap_area *free; struct vm_struct *busy; =20 /* @@ -5447,32 +5459,15 @@ static void __init vmap_init_free_space(void) * |<--------------------------------->| */ for (busy =3D vmlist; busy; busy =3D busy->next) { - if ((unsigned long) busy->addr - vmap_start > 0) { - free =3D kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); - if (!WARN_ON_ONCE(!free)) { - free->va_start =3D vmap_start; - free->va_end =3D (unsigned long) busy->addr; - - insert_vmap_area_augment(free, NULL, - &free_vmap_area_root, - &free_vmap_area_list); - } - } + if ((unsigned long) busy->addr - vmap_start > 0) + vmap_insert_free_area(vmap_start, + (unsigned long) busy->addr); =20 vmap_start =3D (unsigned long) busy->addr + busy->size; } =20 - if (vmap_end - vmap_start > 0) { - free =3D kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); - if (!WARN_ON_ONCE(!free)) { - free->va_start =3D vmap_start; - free->va_end =3D vmap_end; - - insert_vmap_area_augment(free, NULL, - &free_vmap_area_root, - &free_vmap_area_list); - } - } + if (vmap_end - vmap_start > 0) + vmap_insert_free_area(vmap_start, vmap_end); } =20 static void vmap_init_nodes(void) --=20 2.25.1 From nobody Fri Sep 25 08:45:38 2026 Received: from mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B44C3CFF72 for ; Tue, 15 Sep 2026 02:43:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789440226; cv=none; b=AJplKGNz7rDiCi1GmyChHQv9g13tRfNZ2GXc7CoyRLYAcNw9gYfUWiR6SPSN5XFcu9cwpKM2zlqaz9miW4j/mxhDMA3AzLhr++L26yBvg+nPU05UpZDnhQEtzUPgBytgD3ipqh3w8QBdS5lM4RMTfAaIU+lvnoPnxIRQVxbhjL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789440226; c=relaxed/simple; bh=bALxJHIgAAekMhWqcUjYkzxgbHtb4sDDdgHlmxKh0to=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I47o7rQ0whbSN3Uw/ucidq/NIp4CANzvwmH2wBxVugKeBP99rMYAbxcc1UM4GmfFV3Fn80qM1LJ0bOSoRlEaK8bygIuvkLlNO2tYnfhsyeTqnzoYykhNm1lqSaC5Ieg7xCEnGPUhz9qiELvi+rvU5z5zxP65XdlbCUDYDriYU2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jOLQNcla; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jOLQNcla" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=bALxJHIgAAekMhWqcUjYkzxgbHtb4sDDdgHlmxKh0to=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789440222; v=1; x=1790045022; b=jOLQNclagNVGQExjMJXidEsqipdzNc0JwJw4bcPHEAwXdQ1mEyk9k5JwUqouz8yv2oHwwYiH 0FtHRT8gUjUdRitaoPr4B1xY8wy/O6zBww+DsfpiTkr/uH/V13Y0DbLEgru8o4SKVgO5tIybstx UONbIVXYIZF1IRrxHoz169+E= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id b622b93473112159; Tue, 15 Sep 2026 02:43:42 +0000 X-Mizu-Trace-ID: b622b93473112159 X-Migadu-Flow: FLOW_OUT From: Ye Liu Date: Tue, 15 Sep 2026 10:43:32 +0800 Subject: [PATCH v2 3/3] mm/vmalloc: extract show_busy_info from vmalloc_info_show Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260915-vmalloc_study-v2-3-cc4dfe635e22@linux.dev> References: <20260915-vmalloc_study-v2-0-cc4dfe635e22@linux.dev> In-Reply-To: <20260915-vmalloc_study-v2-0-cc4dfe635e22@linux.dev> To: Andrew Morton , Uladzislau Rezki Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ye Liu X-Mailer: b4 0.14.3 From: Ye Liu Extract the busy vmap area iteration into show_busy_info, mirroring the existing show_purge_info pattern. Signed-off-by: Ye Liu Reviewed-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 973d15ef4f3e..e09d6c8c8b35 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5345,7 +5345,7 @@ static void show_purge_info(struct seq_file *m) } } =20 -static int vmalloc_info_show(struct seq_file *m, void *p) +static void show_busy_info(struct seq_file *m) { struct vmap_node *vn; struct vmap_area *va; @@ -5415,12 +5415,18 @@ static int vmalloc_info_show(struct seq_file *m, vo= id *p) spin_unlock(&vn->busy.lock); } =20 + if (IS_ENABLED(CONFIG_NUMA)) + kfree(counters); +} + +static int vmalloc_info_show(struct seq_file *m, void *p) +{ + show_busy_info(m); + /* * As a final step, dump "unpurged" areas. */ show_purge_info(m); - if (IS_ENABLED(CONFIG_NUMA)) - kfree(counters); return 0; } =20 --=20 2.25.1