linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Marcelo Tosatti <marcelo@kvack.org>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-mm@kvack.org,
	"Daniel Sp蚣g" <daniel.spang@gmail.com>,
	"Rik van Riel" <riel@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [RFC][patch] mem_notify more faster reduce load average
Date: Thu, 27 Dec 2007 13:49:09 +0900	[thread overview]
Message-ID: <20071227134854.7F0E.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <20071225192625.D273.KOSAKI.MOTOHIRO@jp.fujitsu.com>

Hi, Marcelo-san

this patch is a bit improvement against my mem notifications large system patch.
original my patch is too slower reduce load average at after free memory increased.
this patch fixed it.



Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

Index: linux-2.6.23-mem_notify_v3/mm/mem_notify.c
===================================================================
--- linux-2.6.23-mem_notify_v3.orig/mm/mem_notify.c
+++ linux-2.6.23-mem_notify_v3/mm/mem_notify.c
@@ -20,7 +20,8 @@ struct mem_notify_file_info {
         long          last_event;
 };

-atomic_t mem_notify_event = ATOMIC_INIT(0);
+static atomic_t mem_notify_event = ATOMIC_INIT(0);
+static atomic_t mem_notify_event_end = ATOMIC_INIT(0);

 static DECLARE_WAIT_QUEUE_HEAD(mem_wait);
 static atomic_long_t last_mem_notify = ATOMIC_LONG_INIT(INITIAL_JIFFIES);
@@ -76,13 +77,18 @@ static unsigned int mem_notify_poll(stru
        unsigned long bonus;
        unsigned long now;
        unsigned long last;
+       unsigned long event;

        poll_wait(file, &mem_wait, wait);

-        if (file_info->last_event == atomic_read(&mem_notify_event))
+retry:
+       event = atomic_read(&mem_notify_event);
+       if (event == file_info->last_event)
                 goto out;

-retry:
+       if (event == atomic_read(&mem_notify_event_end))
+               goto out;
+
        /* Ugly trick:
           when too many task wakeup,
           control function exit rate for prevent too much freed.
@@ -114,6 +120,8 @@ retry:

        if (pages_free < (pages_high+pages_reserve)*2)
                val = POLLIN;
+       else
+               atomic_set(&mem_notify_event_end, event);

 out:



- kosaki




--
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>

  parent reply	other threads:[~2007-12-27  4:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-24 20:32 [PATCH] mem notifications v3 Marcelo Tosatti
2007-12-25  3:47 ` KOSAKI Motohiro
2007-12-25  4:56   ` [RFC] add poll_wait_exclusive() API KOSAKI Motohiro
2007-12-27 21:05     ` Marcelo Tosatti
2007-12-25  8:31   ` [PATCH] mem notifications v3 KOSAKI Motohiro
2007-12-25 10:31     ` [RFC][patch 1/2] mem notifications v3 improvement for large system KOSAKI Motohiro
2007-12-27 21:04       ` Marcelo Tosatti
2007-12-28  0:38         ` KOSAKI Motohiro
2007-12-25 10:31     ` [RFC][patch 2/2] " KOSAKI Motohiro
2007-12-25 10:41       ` KOSAKI Motohiro
2007-12-27  4:49       ` KOSAKI Motohiro [this message]
2007-12-27 20:13   ` [PATCH] mem notifications v3 Marcelo Tosatti
2007-12-28  1:44     ` KOSAKI Motohiro

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=20071227134854.7F0E.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.spang@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=marcelo@kvack.org \
    --cc=riel@redhat.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