mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <oskar.andero@sonymobile.com>
To: <linux-kernel@vger.kernel.org>, <devel@driverdev.osuosl.org>
Cc: <paulmck@linux.vnet.ibm.com>, <akpm@linux-foundation.org>,
	<rientjes@google.com>, <arve@android.com>,
	<radovan.lekanovic@sonymobile.com>,
	Peter Enderborg <peter.enderborg@sonymobile.com>,
	Oskar Andero <oskar.andero@sonymobile.com>
Subject: [PATCH] lowmemorykiller: Use ktimer instead of jiffies
Date: Thu, 7 Mar 2013 11:32:39 +0100	[thread overview]
Message-ID: <1362652359-23779-1-git-send-email-oskar.andero@sonymobile.com> (raw)

From: Peter Enderborg <peter.enderborg@sonymobile.com>

Reviewed-by: Radovan Lekanovic <radovan.lekanovic@sonymobile.com>
Signed-off-by: Peter Enderborg <peter.enderborg@sonymobile.com>
Signed-off-by: Oskar Andero <oskar.andero@sonymobile.com>
---
 drivers/staging/android/lowmemorykiller.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 3b91b0f..6da9416 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -38,6 +38,7 @@
 #include <linux/rcupdate.h>
 #include <linux/profile.h>
 #include <linux/notifier.h>
+#include <linux/ktime.h>
 
 static uint32_t lowmem_debug_level = 2;
 static short lowmem_adj[6] = {
@@ -55,7 +56,7 @@ static int lowmem_minfree[6] = {
 };
 static int lowmem_minfree_size = 4;
 
-static unsigned long lowmem_deathpending_timeout;
+static ktime_t lowmem_deathpending_timeout;
 
 #define lowmem_print(level, x...)			\
 	do {						\
@@ -117,7 +118,8 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
 			continue;
 
 		if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
-		    time_before_eq(jiffies, lowmem_deathpending_timeout)) {
+		    ktime_us_delta(ktime_get(),
+				   lowmem_deathpending_timeout) < 0) {
 			task_unlock(p);
 			rcu_read_unlock();
 			return 0;
@@ -148,7 +150,8 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
 		lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n",
 			     selected->pid, selected->comm,
 			     selected_oom_score_adj, selected_tasksize);
-		lowmem_deathpending_timeout = jiffies + HZ;
+		lowmem_deathpending_timeout = ktime_add_ns(ktime_get(),
+							   NSEC_PER_SEC/2);
 		send_sig(SIGKILL, selected, 0);
 		set_tsk_thread_flag(selected, TIF_MEMDIE);
 		rem -= selected_tasksize;
-- 
1.7.8.6


             reply	other threads:[~2013-03-07 10:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 10:32 oskar.andero [this message]
2013-03-07 17:25 ` Greg KH
2013-03-08  8:08   ` oskar.andero

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=1362652359-23779-1-git-send-email-oskar.andero@sonymobile.com \
    --to=oskar.andero@sonymobile.com \
    --cc=akpm@linux-foundation.org \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peter.enderborg@sonymobile.com \
    --cc=radovan.lekanovic@sonymobile.com \
    --cc=rientjes@google.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®