On Mon, Jan 28, 2019 at 09:26:42AM -0700, Jens Axboe wrote:
> >> +static void io_free_scq_urings(struct io_ring_ctx *ctx)
> >> +{
> >> +  if (ctx->sq_ring) {
> >> +          page_frag_free(ctx->sq_ring);
> >> +          ctx->sq_ring = NULL;
> >> +  }
> >> +  if (ctx->sq_sqes) {
> >> +          page_frag_free(ctx->sq_sqes);
> >> +          ctx->sq_sqes = NULL;
> >> +  }
> >> +  if (ctx->cq_ring) {
> >> +          page_frag_free(ctx->cq_ring);
> >> +          ctx->cq_ring = NULL;
> >> +  }
> > 
> > Why is this using the page_frag helpers?  Also the callers just free
> > these ctx structure, so there isn't much of a point zeroing them out.
> 
> Why not use the page frag helpers? No point in open-coding it. I can
> kill the zeroing, double call would be a bug anyway.

Because they are at a different level of abstraction, and someone
might change the implementation, and is unlikely to catch the io_uring
mix of interfaces.  If you think this is really useful we should also
export the helpers under a different name and with documentation.
(and add a __get_free_pages version that returns a pointer..)

Reply via email to