mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guoqing Jiang <gqjiang@suse.com>
To: Paolo Valente <paolo.valente@linaro.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	ulf.hansson@linaro.org, broonie@kernel.org,
	linus.walleij@linaro.org, bfq-iosched@googlegroups.com,
	oleksandr@natalenko.name, 162996@studenti.unimore.it,
	Davide Ferrari <davideferrari8@gmail.com>
Subject: Re: [PATCH BUGFIX V2 1/2] block, bfq: put async queues for root bfq groups too
Date: Wed, 10 Jan 2018 09:41:14 +0800	[thread overview]
Message-ID: <b24f17b0-7594-fd78-fdc7-85ffabbc2fed@suse.com> (raw)
In-Reply-To: <20180109092759.5454-2-paolo.valente@linaro.org>



On 01/09/2018 05:27 PM, Paolo Valente wrote:
> For each pair [device for which bfq is selected as I/O scheduler,
> group in blkio/io], bfq maintains a corresponding bfq group. Each such
> bfq group contains a set of async queues, with each async queue
> created on demand, i.e., when some I/O request arrives for it.  On
> creation, an async queue gets an extra reference, to make sure that
> the queue is not freed as long as its bfq group exists.  Accordingly,
> to allow the queue to be freed after the group exited, this extra
> reference must released on group exit.
>
> The above holds also for a bfq root group, i.e., for the bfq group
> corresponding to the root blkio/io root for a given device. Yet, by
> mistake, the references to the existing async queues of a root group
> are not released when the latter exits. This causes a memory leak when
> the instance of bfq for a given device exits. In a similar vein,
> bfqg_stats_xfer_dead is not executed for a root group.
>
> This commit fixes bfq_pd_offline so that the latter executes the above
> missing operations for a root group too.
>
> Reported-by: Holger Hoffstätte <holger@applied-asynchrony.com>
> Reported-by: Guoqing Jiang <gqjiang@suse.com>
> Signed-off-by: Davide Ferrari <davideferrari8@gmail.com>
> Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
> ---
>   block/bfq-cgroup.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
> index da1525ec4c87..d819dc77fe65 100644
> --- a/block/bfq-cgroup.c
> +++ b/block/bfq-cgroup.c
> @@ -775,10 +775,11 @@ static void bfq_pd_offline(struct blkg_policy_data *pd)
>   	unsigned long flags;
>   	int i;
>   
> +	spin_lock_irqsave(&bfqd->lock, flags);
> +
>   	if (!entity) /* root group */
> -		return;
> +		goto put_async_queues;
>   
> -	spin_lock_irqsave(&bfqd->lock, flags);
>   	/*
>   	 * Empty all service_trees belonging to this group before
>   	 * deactivating the group itself.
> @@ -809,6 +810,8 @@ static void bfq_pd_offline(struct blkg_policy_data *pd)
>   	}
>   
>   	__bfq_deactivate_entity(entity, false);
> +
> +put_async_queues:
>   	bfq_put_async_queues(bfqd, bfqg);
>   
>   	spin_unlock_irqrestore(&bfqd->lock, flags);

With this change, bfqg_stats_xfer_dead will be called even entity is not 
existed,
is it necessary? Thanks.

Regards,
Guoqing

  reply	other threads:[~2018-01-10  1:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09  9:27 [PATCH BUGFIX V2 0/2] block, bfq: fix two memory leaks related to cgroups Paolo Valente
2018-01-09  9:27 ` [PATCH BUGFIX V2 1/2] block, bfq: put async queues for root bfq groups too Paolo Valente
2018-01-10  1:41   ` Guoqing Jiang [this message]
2018-01-10  6:13     ` Paolo Valente
2018-01-10  6:31       ` Guoqing Jiang
2018-01-09  9:27 ` [PATCH BUGFIX V2 2/2] block, bfq: release oom-queue ref to root group on exit Paolo Valente
2018-01-09 15:30 ` [PATCH BUGFIX V2 0/2] block, bfq: fix two memory leaks related to cgroups Holger Hoffstätte

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=b24f17b0-7594-fd78-fdc7-85ffabbc2fed@suse.com \
    --to=gqjiang@suse.com \
    --cc=162996@studenti.unimore.it \
    --cc=axboe@kernel.dk \
    --cc=bfq-iosched@googlegroups.com \
    --cc=broonie@kernel.org \
    --cc=davideferrari8@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr@natalenko.name \
    --cc=paolo.valente@linaro.org \
    --cc=ulf.hansson@linaro.org \
    /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

all inboxes | Powered by JetHome®