linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel Spång" <daniel.spang@gmail.com>
To: Marcelo Tosatti <marcelo@kvack.org>
Cc: linux-mm@kvack.org, drepper@redhat.com, riel@redhat.com,
	akpm@linux-foundation.org, mbligh@mbligh.org,
	balbir@linux.vnet.ibm.com, 7eggert@gmx.de
Subject: Re: [RFC Patch] Thrashing notification
Date: Tue, 6 Nov 2007 11:36:24 +0100	[thread overview]
Message-ID: <cfd9edbf0711060236l73549554wb340e08e8b671eac@mail.gmail.com> (raw)
In-Reply-To: <20071105183025.GA4984@dmt>

On 11/5/07, Marcelo Tosatti <marcelo@kvack.org> wrote:
> Hooking into try_to_free_pages() makes the scheme suspectible to
> specifics such as:
>
> - can the task writeout pages?
> - is the allocation a higher order one?
> - in what zones is it operating on?
>
> Remember that notifications are sent to applications which can allocate
> globally... It is not very useful to send notifications for a userspace
> which has a large percentage of its memory in highmem if the system is
> having a lowmem zone shortage (granted that the notify-on-swap heuristic
> has that problem, but you can then argue that swap affects system
> performance globally, and it generally does in desktop systems).

On a swapless system, the alternative is often to get killed by the oom killer.

> Other than that tuning "priority" from try_to_free_pages() is rather
> difficult for users/admins.

Yes, that parameter might need some tuning, but my initial tests show
that is pretty robust if you keep out of the ends of the interval.

> My previous patches had the zone limitation, but the following way of
> asking "are we low on memory?" gets rid of it:
>
> +static unsigned int mem_notify_poll(struct file *file, poll_table *wait)
> +{
> +       unsigned int val = 0;
> +       struct zone *zone;
> +       int tpages_low, tpages_free, tpages_reserve;
> +
> +       tpages_low = tpages_free = tpages_reserve = 0;
> +
> +       poll_wait(file, &mem_wait, wait);
> +
> +       for_each_zone(zone) {
> +               if (!populated_zone(zone))
> +                       continue;
> +               tpages_low += zone->pages_low;
> +               tpages_free += zone_page_state(zone, NR_FREE_PAGES);
> +               /* always use the reserve of the highest allocation type */
> +               tpages_reserve += zone->lowmem_reserve[MAX_NR_ZONES-1];
> +       }
> +
> +       if (mem_notify_status || (tpages_free <= tpages_low + tpages_reserve))
> +               val = POLLIN;
> +
> +       return val;
> +}

--
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-11-06 10:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 14:47 Daniel Spång
2007-11-05 15:43 ` Daniel Spång
2007-11-05 18:30 ` Marcelo Tosatti
2007-11-05 20:17   ` Rik van Riel
2007-11-06 10:41     ` Daniel Spång
2007-11-06 20:01       ` Rik van Riel
2007-11-06 21:27         ` Daniel Spång
2007-11-06 10:36   ` Daniel Spång [this message]

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=cfd9edbf0711060236l73549554wb340e08e8b671eac@mail.gmail.com \
    --to=daniel.spang@gmail.com \
    --cc=7eggert@gmx.de \
    --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 \
    --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