On Fri, Dec 21, 2012 at 5:47 AM, Mel Gorman <mgorman@xxxxxxx> wrote: > On Thu, Dec 20, 2012 at 02:55:22PM -0800, David Rientjes wrote: >> >> This is probably worth discussing now to see if we can't revert >> b22d127a39dd ("mempolicy: fix a race in shared_policy_replace()"), keep it >> only as a spinlock as you suggest, and do what KOSAKI suggested in >> http://marc.info/?l=linux-kernel&m=133940650731255 instead. I don't think >> it's worth trying to optimize this path at the cost of having both a >> spinlock and mutex. > > Jeez, I'm still not keen on that approach for the reasons that are explained > in the changelog for b22d127a39dd. Christ, Mel. Your reasons in b22d127a39dd are weak as hell, and then you come up with *THIS* shit instead: > That leads to this third *ugly* option that conditionally drops the lock > and it's up to the caller to figure out what happened. Fooling around with > how it conditionally releases the lock results in different sorts of ugly. > We now have three ugly sister patches for this. Who wants to be Cinderalla? > > ---8<--- > mm: numa: Release the PTL if calling vm_ops->get_policy during NUMA hinting faults Heck no. In fact, not a f*cking way in hell. Look yourself in the mirror, Mel. This patch is ugly, and *guaranteed* to result in subtle locking issues, and then you have the *gall* to quote the "uhh, that's a bit ugly due to some trivial duplication" thing in commit b22d127a39dd. Reverting commit b22d127a39dd and just having a "ok, if we need to allocate, then drop the lock, allocate, re-get the lock, and see if we still need the new allocation" is *beautiful* code compared to the diseased abortion you just posted. Seriously. Conditional locking is error-prone, and about a million times worse than the trivial fix that Kosaki suggested. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>