Re: [locks] 6d390e4b5d: will-it-scale.per_process_ops -96.6% regression

From: Jeff Layton
Date: Mon Mar 09 2020 - 13:22:32 EST


On Mon, 2020-03-09 at 08:52 -0700, Linus Torvalds wrote:
> On Mon, Mar 9, 2020 at 7:36 AM Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> > On Sun, 2020-03-08 at 22:03 +0800, kernel test robot wrote:
> > > FYI, we noticed a -96.6% regression of will-it-scale.per_process_ops due to commit:
> >
> > This is not completely unexpected as we're banging on the global
> > blocked_lock_lock now for every unlock. This test just thrashes file
> > locks and unlocks without doing anything in between, so the workload
> > looks pretty artificial [1].
> >
> > It would be nice to avoid the global lock in this codepath, but it
> > doesn't look simple to do. I'll keep thinking about it, but for now I'm
> > inclined to ignore this result unless we see a problem in more realistic
> > workloads.
>
> That is a _huge_ regression, though.
>
> What about something like the attached? Wouldn't that work? And make
> the code actually match the old comment about wow "fl_blocker" being
> NULL being special.
>
> The old code seemed to not know about things like memory ordering either.
>
> Patch is entirely untested, but aims to have that "smp_store_release()
> means I'm done and not going to touch it any more", making that
> smp_load_acquire() test hopefully be valid as per the comment..

Yeah, something along those lines maybe. I don't think we can use
fl_blocker that way though, as the wait_event_interruptible is waiting
on it to go to NULL, and the wake_up happens before fl_blocker is
cleared.

Maybe we need to mix in some sort of FL_BLOCK_ACTIVE flag and use that
instead of testing for !fl_blocker to see whether we can avoid the
blocked_lock_lock?

--
Jeff Layton <jlayton@xxxxxxxxxx>