xfs
[Top] [All Lists]

Re: [PATCH 6/7] libxfs: keep unflushable buffers off the cache MRUs

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 6/7] libxfs: keep unflushable buffers off the cache MRUs
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 9 Feb 2016 06:54:37 +1100
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20160208100636.GA27683@xxxxxxxxxxxxx>
References: <1454627108-19036-1-git-send-email-david@xxxxxxxxxxxxx> <1454627108-19036-7-git-send-email-david@xxxxxxxxxxxxx> <20160208100636.GA27683@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Feb 08, 2016 at 02:06:36AM -0800, Christoph Hellwig wrote:
> > --- a/include/cache.h
> > +++ b/include/cache.h
> > @@ -51,6 +51,7 @@ enum {
> >  #define CACHE_BASE_PRIORITY        0
> >  #define CACHE_PREFETCH_PRIORITY    8
> >  #define CACHE_MAX_PRIORITY 15
> > +#define CACHE_DIRTY_PRIORITY       (CACHE_MAX_PRIORITY + 1)
> 
> Sizing arrays based on, and iterating up to CACHE_DIRTY_PRIORITY seems
> rather odd.  Maybe add a new
> 
> #define CACHE_NR_PRIORITIES           CACHE_DIRTY_PRIORITY
> 
> and a comment explaining the magic to make it more obvious?

Ok.

> > +cache_move_to_dirty_mru(
> > +   struct cache            *cache,
> > +   struct cache_node       *node)
> > +{
> > +   struct cache_mru        *mru;
> > +
> > +   mru = &cache->c_mrus[CACHE_DIRTY_PRIORITY];
> > +
> > +   pthread_mutex_lock(&mru->cm_mutex);
> > +   node->cn_priority = CACHE_DIRTY_PRIORITY;
> > +   list_move(&node->cn_mru, &mru->cm_list);
> > +   mru->cm_count++;
> > +   pthread_mutex_unlock(&mru->cm_mutex);
> > +}
> 
> Maybe it would better to just do a list_add here and leave the
> list_del to the caller to avoid needing to nest two different
> cm_mutex instances.

I'll have a look at it.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>