Re: [PATCH] io_uring: Use slab for struct io_buffer objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Gabriel,

I just have a couple of comments.  I don't have an opinion on whether it
makes sense to replace the existing allocator.

-Jeff

> @@ -362,11 +363,12 @@ int io_provide_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
>  	return 0;
>  }
>  
> +#define IO_BUFFER_ALLOC_BATCH (PAGE_SIZE/sizeof(struct io_buffer))
> +
>  static int io_refill_buffer_cache(struct io_ring_ctx *ctx)
>  {
> -	struct io_buffer *buf;
> -	struct page *page;
> -	int bufs_in_page;
> +	struct io_buffer *bufs[IO_BUFFER_ALLOC_BATCH];

That's a pretty large on-stack allocation.

> +	allocated = kmem_cache_alloc_bulk(io_buf_cachep, GFP_KERNEL_ACCOUNT,
> +					  ARRAY_SIZE(bufs), (void **) bufs);
> +	if (unlikely(allocated <= 0)) {

Can't be less than 0.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux