lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120220313.GC18056@pauld.bos.csb>
Date:   Wed, 20 Nov 2019 17:03:13 -0500
From:   Phil Auld <pauld@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Dave Chinner <david@...morbit.com>, Ming Lei <ming.lei@...hat.com>,
        linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jeff Moyer <jmoyer@...hat.com>,
        Dave Chinner <dchinner@...hat.com>,
        Eric Sandeen <sandeen@...hat.com>,
        Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
        Ingo Molnar <mingo@...hat.com>, Tejun Heo <tj@...nel.org>,
        Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: single aio thread is migrated crazily by scheduler

Hi Peter,

On Wed, Nov 20, 2019 at 08:16:36PM +0100 Peter Zijlstra wrote:
> On Tue, Nov 19, 2019 at 07:40:54AM +1100, Dave Chinner wrote:
> > On Mon, Nov 18, 2019 at 10:21:21AM +0100, Peter Zijlstra wrote:
> 
> > > We typically only fall back to the active balancer when there is
> > > (persistent) imbalance and we fail to migrate anything else (of
> > > substance).
> > > 
> > > The tuning mentioned has the effect of less frequent scheduling, IOW,
> > > leaving (short) tasks on the runqueue longer. This obviously means the
> > > load-balancer will have a bigger chance of seeing them.
> > > 
> > > Now; it's been a while since I looked at the workqueue code but one
> > > possible explanation would be if the kworker that picks up the work item
> > > is pinned. That would make it runnable but not migratable, the exact
> > > situation in which we'll end up shooting the current task with active
> > > balance.
> > 
> > Yes, that's precisely the problem - work is queued, by default, on a
> > specific CPU and it will wait for a kworker that is pinned to that
> 
> I'm thinking the problem is that it doesn't wait. If it went and waited
> for it, active balance wouldn't be needed, that only works on active
> tasks.

Since this is AIO I wonder if it should queue_work on a nearby cpu by 
default instead of unbound.  

> 
> > specific CPU to dispatch it. We've already tested that queuing on a
> > different CPU (via queue_work_on()) makes the problem largely go
> > away as the work is not longer queued behind the long running fio
> > task.
> > 
> > This, however, is not at viable solution to the problem. The pattern
> > of a long running process queuing small pieces of individual work
> > for processing in a separate context is pretty common...
> 
> Right, but you're putting the scheduler in a bind. By overloading the
> CPU and only allowing the one task to migrate, it pretty much has no
> choice left.
> 
> Anyway, I'm still going to have try and reproduce -- I got side-tracked
> into a crashing bug, I'll hopefully get back to this tomorrow. Lastly,
> one other thing to try is -next. Vincent reworked the load-balancer
> quite a bit.
> 

I've tried it with the lb patch series. I get basically the same results.
With the high granularity settings I get 3700 migrations for the 30 
second run at 4k. Of those about 3200 are active balance on stock 5.4-rc7.
With the lb patches it's 3500 and 3000, a slight drop. 

Using the default granularity settings 50 and 22 for stock and 250 and 25.
So a few more total migrations with the lb patches but about the same active.


On this system I'm getting 100k migrations using 512 byte blocksize. Almost
all not active. I haven't looked into that closely yet but it's like 3000
per second looking like this:

...
64.19641 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19694 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19746 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19665 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.19718 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.19772 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.19800 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19828 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.19856 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19882 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.19909 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19937 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.19967 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.19995 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.20023 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.20053 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.20079 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.20107 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.20135 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.20163 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
64.20192 386     386     kworker/15:1    sched_migrate_task fio/2784 cpu 15->19 
64.20221 389     389     kworker/19:1    sched_migrate_task fio/2784 cpu 19->15 
...

Which is roughly equal to the number if iops it's doing. 

Cheers,
Phil

-- 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ