Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753532AbcCKJJx (ORCPT ); Fri, 11 Mar 2016 04:09:53 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:34623 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752766AbcCKJJk (ORCPT ); Fri, 11 Mar 2016 04:09:40 -0500 Subject: Re: [PATCH] android: lmk: add swap pte pmd in tasksize To: yalin wang , Lu Bing References: <1457681032-178195-1-git-send-email-albert.lubing@hisilicon.com> <8DA5D99D-7542-4ABB-9DB4-076B255A5F75@gmail.com> CC: , , , , , , , , , , , , , , , , From: Chen Feng Message-ID: <56E28A69.9040409@hisilicon.com> Date: Fri, 11 Mar 2016 17:05:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <8DA5D99D-7542-4ABB-9DB4-076B255A5F75@gmail.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.193.64] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.56E28A78.012C,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0d9915a93d89bb05dc57ba22bfdb0afc Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1480 Lines: 48 On 2016/3/11 15:30, yalin wang wrote: > >> On Mar 11, 2016, at 15:23, Lu Bing wrote: >> >> From: l00215322 >> >> 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 >> Reviewed-by: Fu Jun >> Reviewed-by: Xu YiPing >> Reviewed-by: Yu DongBin >> Signed-off-by: Lu Bing >> --- >> 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 . > Since the code is in staging, we can add another patch to do this. >> task_unlock(p); >> if (tasksize <= 0) >> continue; >> -- >> 1.8.3.2 >> > > > . >