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)

Might do I suppose.

> +     current->vmacache[idx] = newvma;
> +}
> -- 
> 1.8.1.4
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to