Re: [PATCH 4/5] lock_cpu_hotplug: Redesign - Lightweight implementation of lock_cpu_hotplug.

From: Gautham R Shenoy
Date: Thu Oct 26 2006 - 23:49:28 EST


On Thu, Oct 26, 2006 at 02:14:50PM -0700, Paul Jackson wrote:
> Gautham wrote:
> + *- Readers assume control iff: *
> + * a) No other reader has a reference and no writer is writing. *
> + * OR *
> + * b) Atleast one reader (on *any* cpu) has a reference. *
>
> Isn't this logically equivalent to stating:
>
> *- Readers assume control iff no writer is writing

It is logically equivalent, but...

> (Or if it's not equivalent, it might be interesting to state why.)

I think it needs to be rephrased.

Because there may be a situation where nr_readers = 0, when a writer
arrives. The writer sets the flag to WRITER_WAITING and performs
a synchronize_sched.

During this time, if a new reader arrives at the scene, it would still
go to sleep, because there are no other active readers in the system.
This despite the fact that the writer is not *writing*.

Thanks for pointing that out :-)

>
> --
> I won't rest till it's the best ...
> Programmer, Linux Scalability
> Paul Jackson <pj@xxxxxxx> 1.925.600.0401

Regards
gautham.
--
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility,
which is still a bargain, because Freedom is priceless!"
-
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/