Re: [PATCH] breaking up the pagemap_lru_lock in rmap

From: peter (peter.zijlstra@chello.nl)
Date: Mon Mar 04 2002 - 15:17:54 EST


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.

Regards,

  Peter Zijlstra

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 07 2002 - 21:00:35 EST