public inbox for [email protected]
 help / color / mirror / Atom feed
From: Christoph Hellwig <[email protected]>
To: Pavel Begunkov <[email protected]>
Cc: Jens Axboe <[email protected]>,
	[email protected], [email protected],
	[email protected], [email protected]
Subject: Re: [RFC for-next v2 2/4] bio: split pcpu cache part of bio_put into a helper
Date: Thu, 20 Oct 2022 01:30:23 -0700	[thread overview]
Message-ID: <Y1EHH/+TBtGn2/[email protected]> (raw)
In-Reply-To: <cd6df8c5289a2df20c338d0842172950b0dedef2.1666122465.git.asml.silence@gmail.com>

> +	if ((bio->bi_opf & REQ_POLLED) && !WARN_ON_ONCE(in_interrupt())) {
> +		bio->bi_next = cache->free_list;
> +		cache->free_list = bio;
> +		cache->nr++;
> +	} else {
> +		put_cpu();
> +		bio_free(bio);
> +		return;
> +	}

This reads a little strange with the return in an else.  Why not:

	if (!(bio->bi_opf & REQ_POLLED) || WARN_ON_ONCE(in_interrupt())) {
		put_cpu();
		bio_free(bio);
		return;
	}

	bio->bi_next = cache->free_list;
	cache->free_list = bio;
	cache->nr++;

but given that the simple free case doesn't care about what CPU we're
on or the per-cpu cache pointer, I think we can simply move the

	cache = per_cpu_ptr(bio->bi_pool->cache, get_cpu());

after the above return as well.


  reply	other threads:[~2022-10-20  8:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 19:50 [RFC for-next v2 0/4] enable pcpu bio caching for IRQ I/O Pavel Begunkov
2022-10-18 19:50 ` [RFC for-next v2 1/4] bio: safeguard REQ_ALLOC_CACHE bio put Pavel Begunkov
2022-10-20  8:26   ` Christoph Hellwig
2022-10-18 19:50 ` [RFC for-next v2 2/4] bio: split pcpu cache part of bio_put into a helper Pavel Begunkov
2022-10-20  8:30   ` Christoph Hellwig [this message]
2022-10-18 19:50 ` [RFC for-next v2 3/4] block/bio: add pcpu caching for non-polling bio_put Pavel Begunkov
2022-10-20  8:31   ` Christoph Hellwig
2022-10-20 12:26     ` Pavel Begunkov
2022-10-18 19:50 ` [RFC for-next v2 4/4] io_uring/rw: enable bio caches for IRQ rw Pavel Begunkov
2022-10-20  8:32 ` [RFC for-next v2 0/4] enable pcpu bio caching for IRQ I/O Christoph Hellwig
2022-10-20 12:40   ` Pavel Begunkov
2022-10-20 12:53     ` Jens Axboe
2022-10-20 12:50 ` (subset) " 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 \
    --in-reply-to=Y1EHH/+TBtGn2/[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