Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1428133
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices |
| Date | 2016-06-21 22:30 +0200 |
| Message-ID | <rMAt3-29u-1@gated-at.bofh.it> (permalink) |
| References | <rMmzL-1zb-3@gated-at.bofh.it> <rMmzL-1zb-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 21 Jun 2016, Ganesh Mahendran wrote:
> lowmem_count() should only count anon pages when we have swap device.
>
Why?
> 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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices Ganesh Mahendran <opensource.ganesh@gmail.com> - 2016-06-21 07:40 +0200
Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices David Rientjes <rientjes@google.com> - 2016-06-21 22:30 +0200
Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices Ganesh Mahendran <opensource.ganesh@gmail.com> - 2016-06-22 06:30 +0200
Re: [PATCH 2/3] staging: lowmemorykiller: count anon pages only when we have swap devices Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-23 10:50 +0200
csiph-web