mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arve Hjønnevåg" <arve@android.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: "Greg KH" <greg@kroah.com>, "Alan Cox" <alan@lxorguk.ukuu.org.uk>,
	"Pavel Machek" <pavel@suse.cz>,
	"Brian Swetland" <swetland@google.com>,
	arve@google.com, "San Mehat" <san@android.com>,
	"Robert Love" <rlove@google.com>,
	linux-kernel@vger.kernel.org,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"Tony Lindgren" <tony@atomide.com>,
	"ext Juha Yrj・" <juha.yrjola@solidboot.com>,
	viktor.rosendahl@nokia.com, "Trilok Soni" <soni.trilok@gmail.com>
Subject: Re: lowmemory android driver not needed?
Date: Wed, 28 Jan 2009 18:51:07 -0800	[thread overview]
Message-ID: <d6200be20901281851k45f9692em1379140c8951c195@mail.gmail.com> (raw)
In-Reply-To: <20090128234209.A949.KOSAKI.MOTOHIRO@jp.fujitsu.com>

On Wed, Jan 28, 2009 at 5:48 PM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
>> To indicate that it is more expensive to restart a killed process than
>> a regular cache page.
>
> I think you already know this answer isn't actual answer.
> anybody know >1 mean expensive. a reviewer want to know why DEFAULT_SEEKS * 16
> is best, not *10 nor *20.

DEFAULT_SEEKS * 16 is probably not best. 10 or 20 probably works just
as well. I don't remember what values I tried, but at some point
lowmem_shrink did not get called often enough to be effective.

>> >> static uint32_t lowmem_debug_level = 2;
>> >> static int lowmem_adj[6] = {
>> >
>> > why do you choice [6]?
>>
>> We use six levels.
>
> if you don't consider other user and other usage case,
> this file can't merge forever.

I never expected it to be merged. I wrote it to allow us to ship a product.

> The top problem is, this file stay on non proper place.
> then, MM folks don't review at all.
>
> I think this patch need to receive MM folks review.

This patch solves two problems for us:
1. It gives us more control over which process gets killed when we run
out of memory. This can easily be fixed in the regular oom killer
instead.
2. It prevents the system from getting unusable due to excessive
demand paging. Before we added the low memory killer, we had devices
stuck for many minutes before the system managed to allocate enough
memory for the oom killer to kick in.
The second problem is the most critical and if it is solved, we will
not need this patch.

>> Another problem we run into is that allocations of contiguous pages
>> can cause kswapd to empty all the caches. This will not trigger this
>> lowmemorykiller or the regular oom killer.
>
> strange usage.
> you shouldn't use high order allocation on embedded machine.

The first level page table on arm needs four contiguous pages. This is
enough to trigger this problem. I suspect the lack of swap makes this
problem much more apparent.

>> How about this:
>> ----
>> diff --git a/drivers/misc/lowmemorykiller.c b/drivers/misc/lowmemorykiller.c
>> index 3715d56..3f4e41a 100644
>> --- a/drivers/misc/lowmemorykiller.c
>> +++ b/drivers/misc/lowmemorykiller.c
>> @@ -71,6 +71,12 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
>>         }
>>         if(nr_to_scan > 0)
>>                 lowmem_print(3, "lowmem_shrink %d, %x, ofree %d, ma
>> %d\n", nr_to_scan, gfp_mask, other_free, min_adj);
>> +       rem = global_page_state(NR_ACTIVE_ANON) +
>> global_page_state(NR_ACTIVE_FILE);
>> +       if (!nr_to_scan || min_adj == OOM_ADJUST_MAX + 1) {
>> +               lowmem_print(5, "lowmem_shrink %d, %x, return %d\n",
>> nr_to_scan, gfp_mask, rem);
>> +               return rem;
>> +       }
>> +
>
> I don't understand your intention.
> if file server machine has tons NR_ACTIVE_FILE, this logic kill many
> process.
>
> Do I misunderstand anything?

It only kills one process at a time, and only if the amount of memory
available is below the selected threshold. The number returned is a
very rough estimate of how much memory can be freed. The old code used
the sum of rss for the killable processes which is not accurate
either.

-- 
Arve Hjønnevåg

  reply	other threads:[~2009-01-29  2:51 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14  1:02 Greg KH
2009-01-14  2:18 ` Brian Swetland
2009-01-14  2:30   ` Arve Hjønnevåg
2009-01-14  3:52     ` Greg KH
2009-01-14 10:43       ` Pavel Machek
2009-01-14 10:48         ` Alan Cox
2009-01-14 12:18           ` MinChan Kim
2009-01-14 22:26           ` Arve Hjønnevåg
2009-01-14 23:17             ` Greg KH
2009-01-14 23:32               ` Arve Hjønnevåg
2009-01-15  0:12                 ` Greg KH
2009-01-15  0:54                   ` [PATCH] Staging: android: Add lowmemorykiller documentation Arve Hjønnevåg
2009-01-15  0:59                     ` Greg KH
2009-01-15 13:32                   ` lowmemory android driver not needed? Trilok Soni
2009-01-15 23:44                     ` Greg KH
2009-01-16  9:02                       ` Paul Mundt
2009-01-16 11:16                         ` KOSAKI Motohiro
2009-01-16 15:23                           ` Greg KH
2009-01-21  2:50                             ` KOSAKI Motohiro
2009-01-21  3:05                               ` Paul Mundt
2009-01-21  3:29                               ` KAMEZAWA Hiroyuki
2009-04-01 18:38                               ` Trilok Soni
2009-04-01 19:33                                 ` David Rientjes
2009-02-03 20:55                         ` Tony Lindgren
2009-01-16 11:42                     ` KOSAKI Motohiro
2009-01-16 13:18                       ` KOSAKI Motohiro
2009-01-22  6:13                         ` Arve Hjønnevåg
2009-01-29  1:48                           ` KOSAKI Motohiro
2009-01-29  2:51                             ` Arve Hjønnevåg [this message]
2009-01-29  3:45                               ` KAMEZAWA Hiroyuki
2009-01-29  4:27                                 ` Greg KH
2009-01-29  4:43                                   ` KOSAKI Motohiro
2009-01-29  4:59                                     ` Greg KH
2009-01-29  5:29                                       ` KOSAKI Motohiro
2009-01-30  6:20                                         ` Greg KH
2009-01-30  6:41                                           ` Brian Swetland
2009-02-03 13:40                                             ` KOSAKI Motohiro
2009-01-29 22:06                               ` Pavel Machek
2009-02-03 14:08                                 ` KOSAKI Motohiro
2009-01-15  7:55           ` David Rientjes
2009-01-14  6:45     ` MinChan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6200be20901281851k45f9692em1379140c8951c195@mail.gmail.com \
    --to=arve@android.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arve@google.com \
    --cc=greg@kroah.com \
    --cc=juha.yrjola@solidboot.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=rlove@google.com \
    --cc=san@android.com \
    --cc=soni.trilok@gmail.com \
    --cc=swetland@google.com \
    --cc=tony@atomide.com \
    --cc=viktor.rosendahl@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®