public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
To: Toshiaki Makita
	<makita.toshiaki-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ruki Sekiya <sekiya.ruki-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
Subject: Re: [PATCH v2 RESEND] cfq-iosched: Fix wrong children_weight calculation
Date: Wed, 27 Aug 2014 08:10:31 -0600	[thread overview]
Message-ID: <53FDE6D7.205@kernel.dk> (raw)
In-Reply-To: <1409128352.11712.2.camel@ubuntu-vm-makita>

On 08/27/2014 02:32 AM, Toshiaki Makita wrote:
> cfq_group_service_tree_add() is applying new_weight at the beginning of
> the function via cfq_update_group_weight().
> This actually allows weight to change between adding it to and subtracting
> it from children_weight, and triggers WARN_ON_ONCE() in
> cfq_group_service_tree_del(), or even causes oops by divide error during
> vfr calculation in cfq_group_service_tree_add().
> 
> The detailed scenario is as follows:
> 1. Create blkio cgroups P and P's child C.
>    Set P's weight to 500 and perform some I/O to apply new_weight.
>    This P's I/O completes before starting C's I/O.
> 2. C starts I/O and cfq_group_service_tree_add() is called with C.
> 3. cfq_group_service_tree_add() walks up the tree during children_weight
>    calculation and adds parent P's weight (500) to children_weight of root.
>    children_weight becomes 500.
> 4. Set P's weight to 1000.
> 5. P starts I/O and cfq_group_service_tree_add() is called with P.
> 6. cfq_group_service_tree_add() applies its new_weight (1000).
> 7. I/O of C completes and cfq_group_service_tree_del() is called with C.
> 8. I/O of P completes and cfq_group_service_tree_del() is called with P.
> 9. cfq_group_service_tree_del() subtracts P's weight (1000) from
>    children_weight of root. children_weight becomes -500.
>    This triggers WARN_ON_ONCE().
> 10. Set P's weight to 500.
> 11. P starts I/O and cfq_group_service_tree_add() is called with P.
> 12. cfq_group_service_tree_add() applies its new_weight (500) and adds it
>     to children_weight of root. children_weight becomes 0. Calculation of
>     vfr triggers oops by divide error.
> 
> weight should be updated right before adding it to children_weight.

I already queued up the previous one yesterday. I'd welcome the
comments, but could you send them against the previous one?

-- 
Jens Axboe

  parent reply	other threads:[~2014-08-27 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27  8:32 [PATCH v2 RESEND] cfq-iosched: Fix wrong children_weight calculation Toshiaki Makita
2014-08-27 12:07 ` Vivek Goyal
     [not found]   ` <20140827120747.GC4260-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-08-28  2:13     ` Toshiaki Makita
2014-08-27 14:10 ` Jens Axboe [this message]
     [not found]   ` <53FDE6D7.205-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2014-08-28  2:16     ` Toshiaki Makita
2014-08-27 14:15 ` Tejun Heo
     [not found]   ` <20140827141505.GA12537-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2014-08-28  2:20     ` Toshiaki Makita

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=53FDE6D7.205@kernel.dk \
    --to=axboe-tswwg44o7x1aa/9udqfwiw@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=makita.toshiaki-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org \
    --cc=sekiya.ruki-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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