Messages in this thread Patch in this message | | | Date | Mon, 22 Aug 2011 14:39:54 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH 2/2] vmscan: use atomic-long for shrinker batching |
| |
On Mon, 22 Aug 2011 14:17:27 +0300 Konstantin Khlebnikov <khlebnikov@openvz.org> wrote:
> Use atomic-long operations instead of looping around cmpxchg(). >
Seems nice.
> diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h > index 790651b..ac6b8ee 100644 > --- a/include/linux/shrinker.h > +++ b/include/linux/shrinker.h > @@ -34,7 +34,7 @@ struct shrinker { > > /* These are for internal use */ > struct list_head list; > - long nr; /* objs pending delete */ > + atomic_long_t nr_in_batch; /* objs pending delete */ > };
This makes shrinker.h have a dependency on atomic.h. shrinker.h is a strange thing that doesn't include its own dependent header files - the shrinker.h includer is responsible for that. And they both need fixups, for safety's sake:
include/linux/fs.h | 2 +- include/linux/mm.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
--- a/include/linux/mm.h~vmscan-use-atomic-long-for-shrinker-batching-fix +++ a/include/linux/mm.h @@ -10,6 +10,7 @@ #include <linux/mmzone.h> #include <linux/rbtree.h> #include <linux/prio_tree.h> +#include <linux/atomic.h> #include <linux/debug_locks.h> #include <linux/mm_types.h> #include <linux/range.h> --- a/include/linux/fs.h~vmscan-use-atomic-long-for-shrinker-batching-fix +++ a/include/linux/fs.h @@ -394,8 +394,8 @@ struct inodes_stat_t { #include <linux/semaphore.h> #include <linux/fiemap.h> #include <linux/rculist_bl.h> -#include <linux/shrinker.h> #include <linux/atomic.h> +#include <linux/shrinker.h> #include <asm/byteorder.h> _
| |