mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	io_uring/rsrc: get rid of io_rsrc_node allocation cache
It's not going to be needed in the fast path going forward, so kill it off. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
							parent
							
								
									7029acd8a9
								
							
						
					
					
						commit
						fbbb8e991d
					
				
					 3 changed files with 7 additions and 20 deletions
				
			
		| 
						 | 
					@ -370,9 +370,6 @@ struct io_ring_ctx {
 | 
				
			||||||
	struct io_rsrc_data		*file_data;
 | 
						struct io_rsrc_data		*file_data;
 | 
				
			||||||
	struct io_rsrc_data		*buf_data;
 | 
						struct io_rsrc_data		*buf_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* protected by ->uring_lock */
 | 
					 | 
				
			||||||
	struct io_alloc_cache		rsrc_node_cache;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	u32			pers_next;
 | 
						u32			pers_next;
 | 
				
			||||||
	struct xarray		personalities;
 | 
						struct xarray		personalities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -312,9 +312,7 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
 | 
				
			||||||
	INIT_LIST_HEAD(&ctx->sqd_list);
 | 
						INIT_LIST_HEAD(&ctx->sqd_list);
 | 
				
			||||||
	INIT_LIST_HEAD(&ctx->cq_overflow_list);
 | 
						INIT_LIST_HEAD(&ctx->cq_overflow_list);
 | 
				
			||||||
	INIT_LIST_HEAD(&ctx->io_buffers_cache);
 | 
						INIT_LIST_HEAD(&ctx->io_buffers_cache);
 | 
				
			||||||
	ret = io_alloc_cache_init(&ctx->rsrc_node_cache, IO_NODE_ALLOC_CACHE_MAX,
 | 
						ret = io_alloc_cache_init(&ctx->apoll_cache, IO_POLL_ALLOC_CACHE_MAX,
 | 
				
			||||||
			    sizeof(struct io_rsrc_node));
 | 
					 | 
				
			||||||
	ret |= io_alloc_cache_init(&ctx->apoll_cache, IO_POLL_ALLOC_CACHE_MAX,
 | 
					 | 
				
			||||||
			    sizeof(struct async_poll));
 | 
								    sizeof(struct async_poll));
 | 
				
			||||||
	ret |= io_alloc_cache_init(&ctx->netmsg_cache, IO_ALLOC_CACHE_MAX,
 | 
						ret |= io_alloc_cache_init(&ctx->netmsg_cache, IO_ALLOC_CACHE_MAX,
 | 
				
			||||||
			    sizeof(struct io_async_msghdr));
 | 
								    sizeof(struct io_async_msghdr));
 | 
				
			||||||
| 
						 | 
					@ -358,7 +356,6 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
 | 
				
			||||||
free_ref:
 | 
					free_ref:
 | 
				
			||||||
	percpu_ref_exit(&ctx->refs);
 | 
						percpu_ref_exit(&ctx->refs);
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	io_alloc_cache_free(&ctx->rsrc_node_cache, kfree);
 | 
					 | 
				
			||||||
	io_alloc_cache_free(&ctx->apoll_cache, kfree);
 | 
						io_alloc_cache_free(&ctx->apoll_cache, kfree);
 | 
				
			||||||
	io_alloc_cache_free(&ctx->netmsg_cache, io_netmsg_cache_free);
 | 
						io_alloc_cache_free(&ctx->netmsg_cache, io_netmsg_cache_free);
 | 
				
			||||||
	io_alloc_cache_free(&ctx->rw_cache, io_rw_cache_free);
 | 
						io_alloc_cache_free(&ctx->rw_cache, io_rw_cache_free);
 | 
				
			||||||
| 
						 | 
					@ -2740,7 +2737,6 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list));
 | 
						WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	io_alloc_cache_free(&ctx->rsrc_node_cache, kfree);
 | 
					 | 
				
			||||||
	if (ctx->mm_account) {
 | 
						if (ctx->mm_account) {
 | 
				
			||||||
		mmdrop(ctx->mm_account);
 | 
							mmdrop(ctx->mm_account);
 | 
				
			||||||
		ctx->mm_account = NULL;
 | 
							ctx->mm_account = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,6 @@
 | 
				
			||||||
#include <uapi/linux/io_uring.h>
 | 
					#include <uapi/linux/io_uring.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "io_uring.h"
 | 
					#include "io_uring.h"
 | 
				
			||||||
#include "alloc_cache.h"
 | 
					 | 
				
			||||||
#include "openclose.h"
 | 
					#include "openclose.h"
 | 
				
			||||||
#include "rsrc.h"
 | 
					#include "rsrc.h"
 | 
				
			||||||
#include "memmap.h"
 | 
					#include "memmap.h"
 | 
				
			||||||
| 
						 | 
					@ -129,16 +128,12 @@ struct io_rsrc_node *io_rsrc_node_alloc(struct io_ring_ctx *ctx, int type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct io_rsrc_node *node;
 | 
						struct io_rsrc_node *node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	node = io_alloc_cache_get(&ctx->rsrc_node_cache);
 | 
						node = kzalloc(sizeof(*node), GFP_KERNEL);
 | 
				
			||||||
	if (!node) {
 | 
						if (node) {
 | 
				
			||||||
		node = kzalloc(sizeof(*node), GFP_KERNEL);
 | 
							node->ctx = ctx;
 | 
				
			||||||
		if (!node)
 | 
							node->refs = 1;
 | 
				
			||||||
			return NULL;
 | 
							node->type = type;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	node->ctx = ctx;
 | 
					 | 
				
			||||||
	node->refs = 1;
 | 
					 | 
				
			||||||
	node->type = type;
 | 
					 | 
				
			||||||
	return node;
 | 
						return node;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -487,8 +482,7 @@ void io_free_rsrc_node(struct io_rsrc_node *node)
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!io_alloc_cache_put(&ctx->rsrc_node_cache, node))
 | 
						kfree(node);
 | 
				
			||||||
		kfree(node);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)
 | 
					static void __io_sqe_files_unregister(struct io_ring_ctx *ctx)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue