Re: [PATCH] android: lmk: add swap pte pmd in tasksize

From: yalin wang
Date: Fri Mar 11 2016 - 02:31:02 EST



> On Mar 11, 2016, at 15:23, Lu Bing <albert.lubing@xxxxxxxxxxxxx> wrote:
>
> From: l00215322 <albert.lubing@xxxxxxxxxxxxx>
>
> Many android devices have zram,so we should add "MM_SWAPENTS" in tasksize.
> Refer oom_kill.c,we add pte&pmd also.
>
> Reviewed-by: Chen Feng <puck.chen@xxxxxxxxxxxxx>
> Reviewed-by: Fu Jun <oliver.fu@xxxxxxxxxxxxx>
> Reviewed-by: Xu YiPing <xuyiping@xxxxxxxxxxxxx>
> Reviewed-by: Yu DongBin <yudongbin@xxxxxxxxxxxxx>
> Signed-off-by: Lu Bing <albert.lubing@xxxxxxxxxxxxx>
> ---
> drivers/staging/android/lowmemorykiller.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
> index 8b5a4a8..0817d3b 100644
> --- a/drivers/staging/android/lowmemorykiller.c
> +++ b/drivers/staging/android/lowmemorykiller.c
> @@ -139,7 +139,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
> task_unlock(p);
> continue;
> }
> - tasksize = get_mm_rss(p->mm);
> + tasksize = get_mm_rss(p->mm) +
> + get_mm_counter(p->mm, MM_SWAPENTS) +
> + atomic_long_read(&p->mm->nr_ptes) + mm_nr_pmds(p->mm);
why not introduce a mm_nr_ptes() help function here ?
more clear to see .

> task_unlock(p);
> if (tasksize <= 0)
> continue;
> --
> 1.8.3.2
>