linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Marcelo Tosatti <marcelo@kvack.org>
Cc: linux-mm@kvack.org, drepper@redhat.com,
	akpm@linux-foundation.org, mbligh@mbligh.org,
	balbir@linux.vnet.ibm.com
Subject: Re: [RFC] oom notifications via /dev/oom_notify
Date: Tue, 30 Oct 2007 17:00:09 -0400	[thread overview]
Message-ID: <20071030170009.6057cbd5@cuia.boston.redhat.com> (raw)
In-Reply-To: <20071030191827.GB31038@dmt>

On Tue, 30 Oct 2007 15:18:27 -0400
Marcelo Tosatti <marcelo@kvack.org> wrote:

> The basic idea here is that applications can be part of the memory
> reclaim process. The notification is loosely defined as "please free
> some small percentage of your memory".

This will be especially useful for things like databases, JVMs
and applications that cache data that can be easily recreated
or read in from disk.  File IO tends to be much faster than
swap IO.

It could also be useful for glibc.  When a userland process
calls free(), a lot of the time the memory is not given back
to the kernel.  After all, chances are the process will need
it again.

If the kernel needs the memory, however, it will be faster for
applications to simply give it back than for the apps to wait
on disk IO.
 
> There is no easy way of finding whether the system is approaching a
> state where swapping is required in the reclaim paths, so a defensive
> approach is taken by using a timer with 1Hz frequency which verifies
> whether swapping has occurred.

Good enough for initial testing.  I will make sure that we will
have a more clearly defined threshold in the split VM code that
I am working on, so we can send the signal before we actually
start swapping.

> +void oom_check_fn(unsigned long unused)
> +{
> +	bool wake = 0;
> +	unsigned int swapped_pages;
> +
> +	swapped_pages = sum_vm_event(PSWPOUT);
> +	if (swapped_pages > prev_swapped_pages)
> +		wake = 1;
> +	prev_swapped_pages = swapped_pages;
> +
> +	oom_notify_status = wake;
> +
> +	if (wake)
> +		wake_up_all(&oom_wait);
> +
> +	return;
> +}

Maybe it would be better if we could do the wakeup earlier, so
we could wake up fewer processes at a time?  Maybe only one?

Thundering herd problems could be bad...

On the other hand, if memory is low on one NUMA node it would
not help at all if we woke up processes from other NUMA nodes...

-- 
All Rights Reversed

--
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-10-30 21:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 19:18 Marcelo Tosatti
2007-10-30 20:57 ` Balbir Singh
2007-10-30 22:16   ` Marcelo Tosatti
2007-10-30 21:00 ` Rik van Riel [this message]
2007-10-30 21:07 ` Marcelo Tosatti
2007-10-30 21:19   ` Rik van Riel
2007-10-30 22:26     ` Marcelo Tosatti
2007-10-31 17:20   ` Dave Jones
2007-11-01 23:58     ` Marcelo Tosatti
2007-10-30 21:59 ` Badari Pulavarty
2007-10-30 21:12   ` Rik van Riel
2007-10-31  4:17     ` Badari
2007-10-31  4:31       ` Rik van Riel
2007-10-31 17:01         ` Badari Pulavarty
2007-10-31 16:15           ` Rik van Riel
2007-10-31  5:38       ` Balbir Singh

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=20071030170009.6057cbd5@cuia.boston.redhat.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=drepper@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=marcelo@kvack.org \
    --cc=mbligh@mbligh.org \
    /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