[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFzi7tHg=3k8Fmga8XmxFbn6tZLLV97vt67Xx_WtckQo6g@mail.gmail.com>
Date: Tue, 26 Jun 2012 12:01:19 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Yinghai Lu <yinghai@...nel.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Tony Luck <tony.luck@...el.com>,
David Miller <davem@...emloft.net>, x86 <x86@...nel.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org
Subject: Re: [PATCH -v12 01/15] resources: Split out __allocate_resource()
On Tue, Jun 26, 2012 at 11:53 AM, Yinghai Lu <yinghai@...nel.org> wrote:
> It will take bool lock, so we could use it in other functions that
> hold the resource lock already.
This is too damn ugly.
These kinds of "conditionally take lock" things are always just bugs
waiting to happen. Don't do it.
Just make the rule be that the caller of the __allocate_resource
helper has to hold the lock. Sure, that means that you need to then
use split reallocate_resource() into a helper function (ie a static
__reallocate_resource() that needs to have the lock taken by the
caller too), but dammit, that's definitely the right thing to do
anyway.
These kinds of "bool lock" crap things have to die. They are *wrong*.
They are a sign of bad locking rules.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists