[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52162F4C.3090205@hp.com>
Date: Thu, 22 Aug 2013 15:33:32 +0000
From: Thavatchai Makphaibulchoke <thavatchai.makpahibulchoke@...com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
CC: T Makphaibulchoke <tmac@...com>, Theodore Ts'o <tytso@....edu>,
"adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>,
Al Viro <viro@...iv.linux.org.uk>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
"Chandramouleeswaran, Aswin" <aswin@...com>
Subject: Re: [PATCH v2 1/2] mbcache: decoupling the locking of local from
global data
Thanks for the comments.
On 08/22/2013 04:53 PM, Linus Torvalds wrote:
>
> Please don't do these ugly and pointless preprocessor macro expanders
> that hide what the actual operation is.
>
> The DEBUG case seems to be just for your own testing anyway, so even
> that shouldn't exist in the merged version.
>
Sorry, will clean them all up.
>
> And this is really ugly. Again it's also then hidden behind the ugly macro.
>
> First off, the thousand-time retry seems completely excessive. Does it
> actually need any retry AT ALL? If the hash entry changes, either you
> should retry forever, or if you feel that can result in livelocks
> (fair enough) and you need a fallback case to a bigger lock, then why
> not just do the fallback immediately?
>
> More importantly, regardless of that retry issue, this seems to be
> abstracted at the wrong level, resulting in every single user of this
> repeating the same complex and hard-to-understand incantation:
>
Looks like this is a misjudgement on my part. There is really no need to guard against mb_cache_entry from moving to a different hash chain, as the shrinking and allocation function already protecting against each other thorugh mb_cache_spinlock. The retry is not needed.
>
> where the only difference is that the last one doesn't unlock
> afterwards because it runs in a loop with that LRU list lock held.
> Ugh.
Followed the above logic, all these pieces of code are also not necessary and could be just a simple unhash, as the original.
>
> The locking logic also isn't explained anywhere, making the
> hard-to-read code even harder to read.
Will add comment, explaining the locking logic.
>
> Linus
>
Thanks,
Mak.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists