lkml.org 
[lkml]   [2014]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] mm: per-thread vma caching
On Tue, Feb 25, 2014 at 10:37:34AM -0800, Davidlohr Bueso wrote:
> On Tue, 2014-02-25 at 19:35 +0100, Peter Zijlstra wrote:
> > On Tue, Feb 25, 2014 at 10:16:46AM -0800, Davidlohr Bueso wrote:
> > > +void vmacache_update(struct mm_struct *mm, unsigned long addr,
> > > + struct vm_area_struct *newvma)
> > > +{
> > > + /*
> > > + * Hash based on the page number. Provides a good
> > > + * hit rate for workloads with good locality and
> > > + * those with random accesses as well.
> > > + */
> > > + int idx = (addr >> PAGE_SHIFT) & 3;
> >
> > % VMACACHE_SIZE
> >
> > perhaps? GCC should turn that into a mask for all sensible values I
> > would think.
> >
> > Barring that I think something like:
> >
> > #define VMACACHE_BITS 2
> > #define VMACACHE_SIZE (1U << VMACACHE_BITS)
> > #define VMACACHE_MASK (VMACACHE_SIZE - 1)
>
> Hmm all that seems like an overkill.

If GCC does the right thing with % VMACACHE_SIZE it gets rid of an ugly
constant. But the 3 VMACACHE_* things are 'better' in that its
impossible to set VMACACHE_SIZE to silly values.


\
 
 \ /
  Last update: 2014-02-25 21:21    [W:0.036 / U:4.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site