public inbox for [email protected]
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <[email protected]>
To: Breno Leitao <[email protected]>
Cc: [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected], [email protected]
Subject: Re: [PATCH v3 1/2] io_uring: Move from hlist to io_wq_work_node
Date: Thu, 23 Feb 2023 16:02:25 -0300	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]> (Breno Leitao's message of "Thu, 23 Feb 2023 08:43:52 -0800")

Breno Leitao <[email protected]> writes:

> Having cache entries linked using the hlist format brings no benefit, and
> also requires an unnecessary extra pointer address per cache entry.
>
> Use the internal io_wq_work_node single-linked list for the internal
> alloc caches (async_msghdr and async_poll)
>
> This is required to be able to use KASAN on cache entries, since we do
> not need to touch unused (and poisoned) cache entries when adding more
> entries to the list.
>

Looking at this patch, I wonder if it could go in the opposite direction
instead, and drop io_wq_work_node entirely in favor of list_head. :)

Do we gain anything other than avoiding the backpointer with a custom
linked implementation, instead of using the interface available in
list.h, that developers know how to use and has other features like
poisoning and extra debug checks?


>  static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *cache)
>  {
> -	if (!hlist_empty(&cache->list)) {
> -		struct hlist_node *node = cache->list.first;
> +	if (cache->list.next) {
> +		struct io_cache_entry *entry;
>  
> -		hlist_del(node);
> -		return container_of(node, struct io_cache_entry, node);
> +		entry = container_of(cache->list.next, struct io_cache_entry, node);
> +		cache->list.next = cache->list.next->next;
> +		return entry;
>  	}

From a quick look, I think you could use wq_stack_extract() here

-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2023-02-23 19:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 16:43 [PATCH v3 0/2] io_uring: Add KASAN support for alloc caches Breno Leitao
2023-02-23 16:43 ` [PATCH v3 1/2] io_uring: Move from hlist to io_wq_work_node Breno Leitao
2023-02-23 19:02   ` Gabriel Krisman Bertazi [this message]
2023-02-23 19:39     ` Jens Axboe
2023-02-24 18:32       ` Gabriel Krisman Bertazi
2023-02-24 19:41         ` Jens Axboe
2023-02-24  9:55     ` Breno Leitao
2023-02-23 16:43 ` [PATCH v3 2/2] io_uring: Add KASAN support for alloc_caches Breno Leitao
2023-02-23 19:09   ` Gabriel Krisman Bertazi
2023-03-16 19:01 ` [PATCH v3 0/2] io_uring: Add KASAN support for alloc caches Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox