Re: shrinkers: Add node to indicate where to target shrinking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Thu, Oct 21, 2010 at 11:00 AM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> > Add a field node to struct shrinker that can be used to indicate on which
> > node the reclaim should occur. The node field also can be set to NUMA_NO_NODE
> > in which case a reclaim pass over all nodes is desired.
> >
> > Index: linux-2.6/mm/vmscan.c
> > ===================================================================
> > --- linux-2.6.orig/mm/vmscan.c  2010-10-21 12:50:21.000000000 -0500
> > +++ linux-2.6/mm/vmscan.c       2010-10-21 12:50:31.000000000 -0500
> > @@ -202,7 +202,7 @@ EXPORT_SYMBOL(unregister_shrinker);
> >  * Returns the number of slab objects which we shrunk.
> >  */
> >  unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
> > -                       unsigned long lru_pages)
> > +                       unsigned long lru_pages, int node)
> >  {
> >        struct shrinker *shrinker;
> >        unsigned long ret = 0;
> > @@ -218,6 +218,7 @@ unsigned long shrink_slab(unsigned long
> >                unsigned long total_scan;
> >                unsigned long max_pass;
> >
> > +               shrinker->node = node;
> >                max_pass = (*shrinker->shrink)(shrinker, 0, gfp_mask);
> >                delta = (4 * scanned) / shrinker->seeks;
> >                delta *= max_pass;
> 
> Apologies for coming late to the party, but I have to ask - is there
> anything protecting shrinker->node from concurrent modification if
> several threads are trying to reclaim memory at once ?

shrinker_rwsem? :)

> 
> (I note that there was already something similar done to shrinker->nr
> field, so I am probably missing some subtlety in the locking ?)


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]