Re: [patch] optimise loop driver a bit

From: Nick Piggin
Date: Tue Apr 26 2005 - 07:14:07 EST


On Tue, 2005-04-26 at 05:04 -0700, Andrew Morton wrote:
> Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:
> >
> > Looks like locking can be optimised quite a lot.
>
> So I've peered suspiciously at the ->lo_pending handling for some time and
> am unconvinced. Are you sure that the error path in loop_make_request() is
> correct? The old code decremented the pending count in there.
>

Pretty sure it is correct. I'm usually wrong though :P

It decremented lo_pending because it had previously incremented it.
We do away with that and do that under a single critical section,
with the increment done _after_ all error checking. So...

> Why do we need that nasty-looking `pending' local in loop_thread()?

Don't I guess, no. If it reaches zero at any stage then that's
where it should stay. So I think you can just read lo_pending.

Nick

--
SUSE Labs, Novell Inc.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/