linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>, Waiman Long <longman@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] block: Revert "let blkcg_gq grab request queue's refcnt"
Date: Wed, 1 Feb 2023 12:29:41 +0800	[thread overview]
Message-ID: <Y9nqtcbKYAyE/lB7@T590> (raw)
In-Reply-To: <Y9nGsMEiecgnQDfE@T590>

On Wed, Feb 01, 2023 at 09:56:00AM +0800, Ming Lei wrote:
> On Tue, Jan 31, 2023 at 09:31:36AM -0800, Bart Van Assche wrote:
> > On 1/30/23 17:52, Ming Lei wrote:
> > > Hi Bart,
> > > 
> > > On Mon, Jan 30, 2023 at 03:22:57PM -0800, Bart Van Assche wrote:
> > > > Since commit 0a9a25ca7843 ("block: let blkcg_gq grab request queue's
> > > > refcnt") for many request queues the reference count drops to 1 when
> > > > the request queue is destroyed instead of to 0. In other words, the
> > > > request queue is leaked. Fix this by reverting that commit.
> > > 
> > > When/where you observe that the reference count drops to 1 instead of 0?
> > > 
> > > Do you have kmem leak log?
> > > 
> > > Probably, the last drop is in blkg_free_workfn().
> > 
> > Hi Ming,
> > 
> > The reference count leak was discovered while I was testing my patch series
> > that adds support for sub-page limits (https://lore.kernel.org/linux-block/20230130212656.876311-1-bvanassche@acm.org/T/#t).
> > The second patch in that series adds a counter that tracks the number of
> > queues that need support for limits below the page size
> > (sub_page_limit_queues). I noticed that without this patch that counter
> > increases but never decreases. With this patch applied, that counter drops
> > back to zero after having run a test that needs support for sub-page limits.
> 
> I can reproduce the issue by scsi_debug now, but blkg_release() isn't called,
> so looks like one blkcg_gq lifetime issue since blkcg_exit_disk() is really
> run.

The problem is caused by 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()").

This commit will hold blkg instance until blkcg_rstat_flush() is called,
and which may be delayed to css_release_work_fn().

Thanks,
Ming


  reply	other threads:[~2023-02-01  4:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 23:22 [PATCH] block: Revert "let blkcg_gq grab request queue's refcnt" Bart Van Assche
2023-01-31  1:52 ` Ming Lei
2023-01-31 17:31   ` Bart Van Assche
2023-02-01  1:56     ` Ming Lei
2023-02-01  4:29       ` Ming Lei [this message]
2023-02-01 15:55         ` Ming Lei
2023-02-01 20:21           ` Bart Van Assche

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=Y9nqtcbKYAyE/lB7@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=longman@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).