Re: [PATCH] mm: Cleanup in do_shrink_slab()
From: Shakeel Butt
Date: Thu Jul 19 2018 - 12:11:39 EST
On Thu, Jul 19, 2018 at 9:04 AM Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> wrote:
>
> Group long variables together to minimize number of occupied lines
> and place all definitions in back Christmas tree order. Also,
> simplify expression around batch_size: use all power of C language!
>
> Signed-off-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx>
Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
> ---
> mm/vmscan.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 9918bfc1d2f9..636657213b9b 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -445,16 +445,11 @@ EXPORT_SYMBOL(unregister_shrinker);
> static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
> struct shrinker *shrinker, int priority)
> {
> - unsigned long freed = 0;
> + long total_scan, freeable, nr, new_nr, next_deferred, scanned = 0;
> + long batch_size = shrinker->batch ? : SHRINK_BATCH;
> unsigned long long delta;
> - long total_scan;
> - long freeable;
> - long nr;
> - long new_nr;
> int nid = shrinkctl->nid;
> - long batch_size = shrinker->batch ? shrinker->batch
> - : SHRINK_BATCH;
> - long scanned = 0, next_deferred;
> + unsigned long freed = 0;
>
> freeable = shrinker->count_objects(shrinker, shrinkctl);
> if (freeable == 0 || freeable == SHRINK_EMPTY)
>