[PATCH] xmalloc: drop pool list

Jan Beulich posted 1 patch 5 days, 6 hours ago
Failed in applying to current master (apply log)
[PATCH] xmalloc: drop pool list
Posted by Jan Beulich 5 days, 6 hours ago
From its introduction it has been used solely to add and remove pools.
No list traversal or alike did ever occur. Drop all of this as being dead
code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/xmalloc_tlsf.c
+++ b/xen/common/xmalloc_tlsf.c
@@ -66,9 +66,6 @@
 #define PREV_FREE       (0x2)
 #define PREV_USED       (0x0)
 
-static DEFINE_SPINLOCK(pool_list_lock);
-static LIST_HEAD(pool_list_head);
-
 struct free_ptr {
     struct bhdr *prev;
     struct bhdr *next;
@@ -113,8 +110,6 @@ struct xmem_pool {
     xmem_pool_get_memory *get_mem;
     xmem_pool_put_memory *put_mem;
 
-    struct list_head list;
-
     char name[MAX_POOL_NAME_LEN];
 };
 
@@ -340,10 +335,6 @@ struct xmem_pool *xmem_pool_create(
 
     spin_lock_init(&pool->lock);
 
-    spin_lock(&pool_list_lock);
-    list_add_tail(&pool->list, &pool_list_head);
-    spin_unlock(&pool_list_lock);
-
     return pool;
 }
 
@@ -373,10 +364,6 @@ void xmem_pool_destroy(struct xmem_pool
                "%lu bytes still in use.\n",
                pool->name, pool, xmem_pool_get_used_size(pool));
 
-    spin_lock(&pool_list_lock);
-    list_del_init(&pool->list);
-    spin_unlock(&pool_list_lock);
-
     pool_bytes = ROUNDUP_SIZE(sizeof(*pool));
     pool_order = get_order_from_bytes(pool_bytes);
     free_xenheap_pages(pool,pool_order);
Re: [PATCH] xmalloc: drop pool list
Posted by Andrew Cooper 5 days, 5 hours ago
On 29/06/2026 3:06 pm, Jan Beulich wrote:
> From its introduction it has been used solely to add and remove pools.
> No list traversal or alike did ever occur. Drop all of this as being dead
> code.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Re: [PATCH] xmalloc: drop pool list
Posted by Oleksii Kurochko 5 days, 5 hours ago

On 6/29/26 4:06 PM, Jan Beulich wrote:
>  From its introduction it has been used solely to add and remove pools.
> No list traversal or alike did ever occur. Drop all of this as being dead
> code.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/common/xmalloc_tlsf.c
> +++ b/xen/common/xmalloc_tlsf.c
> @@ -66,9 +66,6 @@
>   #define PREV_FREE       (0x2)
>   #define PREV_USED       (0x0)
>   
> -static DEFINE_SPINLOCK(pool_list_lock);
> -static LIST_HEAD(pool_list_head);
> -
>   struct free_ptr {
>       struct bhdr *prev;
>       struct bhdr *next;
> @@ -113,8 +110,6 @@ struct xmem_pool {
>       xmem_pool_get_memory *get_mem;
>       xmem_pool_put_memory *put_mem;
>   
> -    struct list_head list;
> -
>       char name[MAX_POOL_NAME_LEN];
>   };
>   
> @@ -340,10 +335,6 @@ struct xmem_pool *xmem_pool_create(
>   
>       spin_lock_init(&pool->lock);
>   
> -    spin_lock(&pool_list_lock);
> -    list_add_tail(&pool->list, &pool_list_head);
> -    spin_unlock(&pool_list_lock);
> -
>       return pool;
>   }
>   
> @@ -373,10 +364,6 @@ void xmem_pool_destroy(struct xmem_pool
>                  "%lu bytes still in use.\n",
>                  pool->name, pool, xmem_pool_get_used_size(pool));
>   
> -    spin_lock(&pool_list_lock);
> -    list_del_init(&pool->list);
> -    spin_unlock(&pool_list_lock);
> -
>       pool_bytes = ROUNDUP_SIZE(sizeof(*pool));
>       pool_order = get_order_from_bytes(pool_bytes);
>       free_xenheap_pages(pool,pool_order);
> 

LGTM:
  Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

~ Oleksii