Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434957

Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Ganesh Mahendran <opensource.ganesh@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices
Date Fri, 01 Jul 2016 04:10:01 +0200
Message-ID <rPW41-Ex-5@gated-at.bofh.it> (permalink)
References <rMmzL-1zb-3@gated-at.bofh.it> <rMmzL-1zb-1@gated-at.bofh.it> <rMAt3-29u-1@gated-at.bofh.it> <rMHXA-73p-9@gated-at.bofh.it> <rN8uK-7ox-31@gated-at.bofh.it>
X-Original-To Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4YbCEYFoQlztNBg6fvepefcFFtr/XOnr7e35uh+0imE=; b=thCBWNkvyDoTAxR8IQGrxbKkcNM/f8IiXPYEcUyChImnFsry0SV6/nGM8AunSITQEk oO42IZvmzYcpfsd7+uLxSTQlcYnO2gurrXdryLTnEh6nwB728gK1eaDjkDENxlyBsl5l u4lqrnWRL9EIIpeKW57T64GMdYSvKcJC/gK2NL7OoadOgCibLIlUzZoPY50cDfkfWEaD SNv4oZpjseqRPvcBkynq3QxcjFf2VwJqFEagg2bbZBH6xVvwa0yhVajTUCRcsV7CCXJH IhUXWZ+erhwMqoo4sqIBLA1xUt64nQGIPUJadCB02QhPmiVL96yAEwj6vxnzjzN4EF3w A7Jg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4YbCEYFoQlztNBg6fvepefcFFtr/XOnr7e35uh+0imE=; b=Oi1jmLl99dvqRunvwuBa+TtDXf8Ig5pvlMhb2PP+EexWvT9c/RmtUEot03YEBLzQUB NHYYWN55zdcbrXMRE+z6Zs3ayhVj2RQRjQfmHGJtSMv/eQ7EN89jEb2fgos0iX6auzjc tDZUEacXpGy5z6NAVIXVIN+mdcC3zE/orG7eVTNKI4WzUZHGUfYXcDAAB2rTVTzKLUUe v5UMOb7pf5uNy1KYCK7A9P2duAVEBOTOZ+aYS5lwQjWX6irlpgy5xe2IzB3yzV2f8QTb lfHghjwR0vvJ2gqug3rS0KfJEbtX6lj1le24Z9GSjyrJoboIH9IL4g4szF/mORAjHuI9 1CdA==
X-Gm-Message-State ALyK8tJVFxi1l66bWEvhMlKp4DMqlJ/CjNCblx/HPK+8f0zYRFIPylVth2IpnK8aV2FAEvKxzjd1PdtdYu5A/A==
X-Received by 10.194.8.38 with SMTP id o6mr908127wja.13.1467338560069; Thu, 30 Jun 2016 19:02:40 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 49
Organization linux.* mail to news gateway
X-Original-Cc David Rientjes <rientjes@google.com>, devel@driverdev.osuosl.org, Greg KH <gregkh@linuxfoundation.org>, arve@android.com, riandrews@android.com, linux-kernel <linux-kernel@vger.kernel.org>, Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
X-Original-Date Fri, 1 Jul 2016 10:02:39 +0800
X-Original-Message-ID <CADAEsF8e2UgagtfZBjaK9J3ejnGFMmeznjzhm71ueJJ=rt0DJA@mail.gmail.com>
X-Original-References <1466487018-5410-1-git-send-email-opensource.ganesh@gmail.com> <1466487018-5410-2-git-send-email-opensource.ganesh@gmail.com> <alpine.DEB.2.10.1606211321020.28466@chino.kir.corp.google.com> <20160622032751.GB5683@leo-test> <20160623084200.GA526@swordfish>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1434957

Show key headers only | View raw


2016-06-23 16:42 GMT+08:00 Sergey Senozhatsky
<sergey.senozhatsky.work@gmail.com>:
> On (06/22/16 11:27), Ganesh Mahendran wrote:
> [..]
>> > > Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
>> > > ---
>> > >  drivers/staging/android/lowmemorykiller.c | 12 ++++++++----
>> > >  1 file changed, 8 insertions(+), 4 deletions(-)
>> > >
>> > > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
>> > > index 6da9260..1d8de47 100644
>> > > --- a/drivers/staging/android/lowmemorykiller.c
>> > > +++ b/drivers/staging/android/lowmemorykiller.c
>> > > @@ -73,10 +73,14 @@ static unsigned long lowmem_deathpending_timeout;
>> > >  static unsigned long lowmem_count(struct shrinker *s,
>> > >                             struct shrink_control *sc)
>> > >  {
>> > > - return global_page_state(NR_ACTIVE_ANON) +
>> > > -         global_page_state(NR_ACTIVE_FILE) +
>> > > -         global_page_state(NR_INACTIVE_ANON) +
>> > > -         global_page_state(NR_INACTIVE_FILE);
>> > > + unsigned long freeable = global_page_state(NR_ACTIVE_FILE) +
>> > > +                         global_page_state(NR_INACTIVE_FILE);
>> > > +
>> > > + if (get_nr_swap_pages() > 0)
>> > > +         freeable += global_page_state(NR_ACTIVE_ANON) +
>> > > +                         global_page_state(NR_INACTIVE_ANON);
>> > > +
>> > > + return freeable;
>> > >  }
>> > >
>> > >  static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
>> >
>> > Shouldn't this be advertising the amount of memory that is freeable by
>> > killing the process with the highest priority oom_score_adj?  It's not
>> > legitimate to say it can free all anon and file memory if nothing is oom
>> > killable, so this function is wrong both originally and with your patched
>> > version.
>>
>> Yes, so should we just simply return 1 to make do_shrink_slab() go ahead?
>> Then lowmem_scan() will do the real job to scan all the process.
>
> hm, looking at ->scan (lowmem_scan) shouldn't it return SHRINK_STOP
> when it has nothing to free instead of 0?

Yes, you are right. It should return SHRINK_STOP.

>
>         -ss

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when  we have swap devices Ganesh Mahendran <opensource.ganesh@gmail.com> - 2016-07-01 04:10 +0200

csiph-web