Thread (19 messages) 19 messages, 4 authors, 2019-01-31

Re: [PATCH 05/18] Add io_uring IO interface

flat view

From: Jens Axboe <axboe@kernel.dk>
Date: 2019-01-28 19:32:13
Also in: linux-block, linux-fsdevel, linux-man

On 1/28/19 9:34 AM, Christoph Hellwig wrote:
On Mon, Jan 28, 2019 at 09:26:42AM -0700, Jens Axboe wrote:
quoted
quoted
quoted
+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..)
Fair enough, I'll avoid using the page_frag_free().

-- 
Jens Axboe

--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help