Re: [PATCH 2/2] vmscan: use atomic-long for shrinker batching

From: Dave Chinner
Date: Mon Aug 22 2011 - 19:26:57 EST


On Mon, Aug 22, 2011 at 02:17:27PM +0300, Konstantin Khlebnikov wrote:
> Use atomic-long operations instead of looping around cmpxchg().
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
> ---
> include/linux/shrinker.h | 2 +-
> mm/vmscan.c | 17 +++++++----------
> 2 files changed, 8 insertions(+), 11 deletions(-)
>
> 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 */

It's not really the number in a batch - we use the "batch" term to
refer to the value we set sc->nr_to_scan for each shrinker scan call.
This is more the overflow of unscanned objects - objects pending
delete, as the comment says. So renaming it "nr_pending" might be
better.

As it is, this is a good change - I'll fold it into the series I
already have.

Cheers,

Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/