From: Chintan Pandya <cpandya@codeaurora.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Weijie Yang <weijie.yang@samsung.com>,
David Rientjes <rientjes@google.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, linux-mm@kvack.org,
Chintan Pandya <cpandya@codeaurora.org>
Subject: [PATCH] lowmemorykiller: Avoid excessive/redundant calling of LMK
Date: Mon, 12 Jan 2015 21:38:43 +0530 [thread overview]
Message-ID: <1421078923-29485-1-git-send-email-cpandya@codeaurora.org> (raw)
The global shrinker will invoke lowmem_shrink in a loop.
The loop will be run (total_scan_pages/batch_size) times.
The default batch_size will be 128 which will make
shrinker invoking 100s of times. LMK does meaningful
work only during first 2-3 times and then rest of the
invocations are just CPU cycle waste. Fix that by giving
excessively large batch size so that lowmem_shrink will
be called just once and in the same try LMK does the
needful.
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
---
drivers/staging/android/lowmemorykiller.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index b545d3d..5bf483f 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -110,7 +110,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) {
lowmem_print(5, "lowmem_scan %lu, %x, return 0\n",
sc->nr_to_scan, sc->gfp_mask);
- return 0;
+ return SHRINK_STOP;
}
selected_oom_score_adj = min_score_adj;
@@ -163,6 +163,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
set_tsk_thread_flag(selected, TIF_MEMDIE);
send_sig(SIGKILL, selected, 0);
rem += selected_tasksize;
+ } else {
+ rcu_read_unlock();
+ return SHRINK_STOP;
}
lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n",
--
Chintan Pandya
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Chintan Pandya <cpandya@codeaurora.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Weijie Yang <weijie.yang@samsung.com>,
David Rientjes <rientjes@google.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, linux-mm@kvack.org,
Chintan Pandya <cpandya@codeaurora.org>
Subject: [PATCH] lowmemorykiller: Avoid excessive/redundant calling of LMK
Date: Mon, 12 Jan 2015 21:38:43 +0530 [thread overview]
Message-ID: <1421078923-29485-1-git-send-email-cpandya@codeaurora.org> (raw)
The global shrinker will invoke lowmem_shrink in a loop.
The loop will be run (total_scan_pages/batch_size) times.
The default batch_size will be 128 which will make
shrinker invoking 100s of times. LMK does meaningful
work only during first 2-3 times and then rest of the
invocations are just CPU cycle waste. Fix that by giving
excessively large batch size so that lowmem_shrink will
be called just once and in the same try LMK does the
needful.
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
---
drivers/staging/android/lowmemorykiller.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index b545d3d..5bf483f 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -110,7 +110,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) {
lowmem_print(5, "lowmem_scan %lu, %x, return 0\n",
sc->nr_to_scan, sc->gfp_mask);
- return 0;
+ return SHRINK_STOP;
}
selected_oom_score_adj = min_score_adj;
@@ -163,6 +163,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
set_tsk_thread_flag(selected, TIF_MEMDIE);
send_sig(SIGKILL, selected, 0);
rem += selected_tasksize;
+ } else {
+ rcu_read_unlock();
+ return SHRINK_STOP;
}
lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n",
--
Chintan Pandya
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
next reply other threads:[~2015-01-12 16:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 16:08 Chintan Pandya [this message]
2015-01-12 16:08 ` [PATCH] lowmemorykiller: Avoid excessive/redundant calling of LMK Chintan Pandya
2015-01-12 16:14 ` Chintan Pandya
2015-01-12 16:14 ` Chintan Pandya
-- strict thread matches above, loose matches on Subject: below --
2015-01-12 16:19 Chintan Pandya
2015-01-12 16:19 ` Chintan Pandya
2015-01-15 17:03 ` Michal Hocko
2015-01-15 17:03 ` Michal Hocko
2015-01-30 0:44 ` John Stultz
2015-01-30 0:44 ` John Stultz
2015-01-30 2:04 ` Rom Lemarchand
2015-01-30 2:08 ` Rom Lemarchand
2015-01-30 2:08 ` Rom Lemarchand
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=1421078923-29485-1-git-send-email-cpandya@codeaurora.org \
--to=cpandya@codeaurora.org \
--cc=akpm@linux-foundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=weijie.yang@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.