mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: peter <peter.zijlstra@chello.nl>
To: "Martin J. Bligh" <Martin.Bligh@us.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	lse-tech@lists.sourceforge.net
Subject: Re: [PATCH] breaking up the pagemap_lru_lock in rmap
Date: 04 Mar 2002 21:17:54 +0100	[thread overview]
Message-ID: <1015273075.21556.95.camel@twins.localnet> (raw)
In-Reply-To: <194860000.1015265091@flay>
In-Reply-To: <194860000.1015265091@flay>

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





  reply	other threads:[~2002-03-04 20:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-04 18:04 Martin J. Bligh
2002-03-04 20:17 ` peter [this message]
2002-03-05  2:02 ` Andrea Arcangeli
2002-03-05  5:17   ` Martin J. Bligh
2002-03-05 12:31     ` Rik van Riel
2002-03-09  5:20   ` breaking up the pagemap_lru_lock (was in rmap, now everywhere ;-) ) Martin J. Bligh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1015273075.21556.95.camel@twins.localnet \
    --to=peter.zijlstra@chello.nl \
    --cc=Martin.Bligh@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®