[lkml]   [2002]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] breaking up the pagemap_lru_lock in rmap
On Mon, 2002-03-04 at 19:04, Martin J. Bligh wrote:
> High contention on the pagemap_lru lock seems to be a major
> scalability problem for rmap at the moment. Based on wli's and
> Rik's suggestions, I've made a first cut at a patch to split up the
> lock into a per-page lock for each pte_chain.
> This isn't ready to go yet - I'm not going to pretend it works. I'm
> looking for feedback on the approach, and any obvious blunders
> I've made in coding. I plan to move the lock in the pages_struct
> into the flags field to save space once it's working reliably.
> If I may steal akpm's favourite disclaimer - "I know diddly squat
> about ......" ;-) Flame away .....
> Thanks,
> Martin.

Hi, knowing less that diddly squat about the code being discussed.
I would like to mention that I usually use some little macro's
to get rid of code like:

lock( my_lock);
if ( exp) {
unlock( my_lock);
/* do fancy stuph */
} else
unlock( my_lock);

and make it look like this:

#define LOCK_EXP_F( exp, lock, f_lock, f_unlock) \
({ typeof( exp) e; \
f_lock( lock); \
e = (exp); \
f_unlock( lock); \
e; })

#define PAGELOCK_EXP( exp, page) \
LOCK_EXP_F( exp, page, pte_chain_lock, pte_chain_unlock)

if ( PAGELOCK_EXP( !page->pte_chain &&
(!page->buffers || do_flushpage( page, 0)), page))
lru_cache_del( page);

If this is a not accepted coding style, so be it.

Another little thing I've been wondering about is why keep using
LRU style caches. Has anybody ever thought about using LRU-K
caches? I know, they aren't O(1), but O(log(n)) isn't that bad
agains the advantages:
- easier to make concurrent (no head contention)
- better caching properties (takes low frequency
entries and cache sweeps into account)

just my 2ct.


Peter Zijlstra

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:24    [W:0.045 / U:5.612 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site