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: Re: [PATCH] mem notifications v3
Date: Tue, 25 Dec 2007 12:47:49 +0900 [thread overview]
Message-ID: <20071225122326.D25C.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <20071224203250.GA23149@dmt>
Hi
> +/* maximum 5 notifications per second per cpu */
> +void mem_notify_userspace(void)
> +{
> + unsigned long target;
> + unsigned long now = jiffies;
> +
> + target = __get_cpu_var(last_mem_notify) + (HZ/5);
> +
> + if (time_after(now, target)) {
> + __get_cpu_var(last_mem_notify) = now;
> + mem_notify_status = 1;
> + wake_up(&mem_wait);
> + }
> +}
Hmm,
unfotunately, wake_up() wake up all process.
because
1. poll method use poll_wait().
2. poll_wait() not add_wait_queue_exclusive() but add_wait_queue() is used.
3. wake_up() function wake up 1 task *and* queueud item by add_wait_queue().
Conclusion:
this code intention wakeup all process HZ/5 * #cpus times at high memory pressure.
it is too much.
BTW: I propose add to poll_wait_exclusive() in kernel ;-p
> + /* check if its not a spurious/stale notification */
> + pages_high = pages_free = pages_reserve = 0;
> + for_each_zone(zone) {
> + if (!populated_zone(zone) || is_highmem(zone))
> + continue;
i think highmem ignoreed is very good improvement from before version :-D
> + pages_reserve += zone->lowmem_reserve[MAX_NR_ZONES-1];
Hmm...
may be, don't works well.
MAX_NR_ZONES determined at compile time and determined by distribution vendor.
but real highest zone is determined by box total memory.
ex.
CONFIG_HIGHMEM config on but total memory < 4GB.
CONFIG_DMA32 config on but total memory < 4GB.
> + if (pages_free < (pages_high+pages_reserve)*2)
> + val = POLLIN;
why do you choice fomula of (pages_high+pages_reserve)*2 ?
> -static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
> +static bool shrink_active_list(unsigned long nr_pages, struct zone *zone,
> struct scan_control *sc, int priority)
unnecessary type change.
if directly call mem_notify_userspace() in shrink_active_list, works well too.
because notify rate control can implement by mem_notify_userspace() and mem_notify_poll().
last_mem_notify works better.
/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>
next prev parent reply other threads:[~2007-12-25 3:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-24 20:32 Marcelo Tosatti
2007-12-25 3:47 ` KOSAKI Motohiro [this message]
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 ` [RFC][patch] mem_notify more faster reduce load average KOSAKI Motohiro
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=20071225122326.D25C.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