All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, Hugh Dickins <hughd@google.com>,
	Richard Davies <richard@arachsys.com>,
	Shaohua Li <shli@kernel.org>, Rafael Aquini <aquini@redhat.com>
Subject: Re: [PATCH 1/7] mm: remove ZONE_RECLAIM_LOCKED
Date: Wed, 26 Jun 2013 22:10:11 +0200	[thread overview]
Message-ID: <20130626201011.GB28030@redhat.com> (raw)
In-Reply-To: <51BF519C.9000508@redhat.com>

Hi!

On Mon, Jun 17, 2013 at 02:12:44PM -0400, Rik van Riel wrote:
> On 06/17/2013 05:30 AM, Mel Gorman wrote:
> > On Fri, Jun 14, 2013 at 12:16:47PM -0400, Rik van Riel wrote:
> >> On 06/06/2013 01:37 PM, Rik van Riel wrote:
> >>> On 06/06/2013 05:04 AM, Mel Gorman wrote:
> >>>> On Wed, Jun 05, 2013 at 05:10:31PM +0200, Andrea Arcangeli wrote:
> >>>>> Zone reclaim locked breaks zone_reclaim_mode=1. If more than one
> >>>>> thread allocates memory at the same time, it forces a premature
> >>>>> allocation into remote NUMA nodes even when there's plenty of clean
> >>>>> cache to reclaim in the local nodes.
> >>>>>
> >>>>> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
> >>>>
> >>>> Be aware that after this patch is applied that it is possible to have a
> >>>> situation like this
> >>>>
> >>>> 1. 4 processes running on node 1
> >>>> 2. Each process tries to allocate 30% of memory
> >>>> 3. Each process reads the full buffer in a loop (stupid, just an example)
> >>>>
> >>>> In this situation the processes will continually interfere with each
> >>>> other until one of them gets migrated to another zone by the scheduler.
> >>>
> >>> This is a very good point.
> >>>
> >>> Andrea, I suspect we will need some kind of safeguard against
> >>> this problem.
> >>
> >> Never mind me.
> >>
> >> In __zone_reclaim we set the flags in swap_control so
> >> we never unmap pages or swap pages out at all by
> >> default, so this should not be an issue at all.
> >>
> >> In order to get the problem illustrated above, the
> >> user will have to enable RECLAIM_SWAP through sysfs
> >> manually.
> >>
> >
> > For the mapped case and the default tuning for zone_reclaim_mode then
> > yes. If instead of allocating 30% of memory the processes are using using
> > buffered reads/writes then they'll reach each others page cache pages and
> > it's a very similar problem.
> 
> Could we fix that problem by simply allowing page cache
> allocations (__GFP_WRITE) to fall back to other zones,
> regardless of the zone_reclaim setting?
> 
> The ZONE_RECLAIM_LOCKED function seems to break as many
> things as it fixes, so replacing it with something else
> seems like a worthwhile pursuit...

I actually don't see a connection between the various scenarios
described above with ZONE_RECLAIM_LOCKED. I mean whatever problem you
are having with swapping or excessive reclaim in a single zone/node
despite the other zones/nodes are completely free, could materialize
the same way with the current ZONE_RECLAIM_LOCKED code if you just use
a mutex in userland to serialize the memory allocations. Or if they
just happen to run serially for other reasons.

If it was a problem to keep insisting calling zone_reclaim in any
given zone, the problem would eventually materialize anyway, by just
running a single thread in the whole system pinned to a single node.

ZONE_RECLAIM_LOCKED isn't about swapping or memory pressure, it is
only about preventing running more than one zone_reclaim function at
once in any given zone. But that shall be ok. If all zone_reclaim()
running in parallel are doing a .nr_to_reclaim = SWAP_CLUSTER_MAX
shrinkage attempt with may_unmap/may_writepage unset
(zone_reclaim_mode is <=1), there shall be no problem. And
zone_reclaim won't be called anymore as soon as the watermark is above
"low".

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

  reply	other threads:[~2013-06-26 20:10 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 15:10 [PATCH 0/7] RFC: adding compaction to zone_reclaim_mode > 0 Andrea Arcangeli
2013-06-05 15:10 ` [PATCH 1/7] mm: remove ZONE_RECLAIM_LOCKED Andrea Arcangeli
2013-06-05 19:23   ` Rik van Riel
2013-06-05 20:37   ` KOSAKI Motohiro
2013-06-05 20:51     ` Christoph Lameter
2013-06-05 21:03       ` KOSAKI Motohiro
2013-06-06 14:15         ` Christoph Lameter
2013-06-06 17:17           ` KOSAKI Motohiro
2013-06-06 18:16             ` Christoph Lameter
2013-06-05 21:33   ` Rafael Aquini
2013-06-06  9:04   ` Mel Gorman
2013-06-06 17:37     ` Rik van Riel
2013-06-14 16:16       ` Rik van Riel
2013-06-17  9:30         ` Mel Gorman
2013-06-17 18:12           ` Rik van Riel
2013-06-26 20:10             ` Andrea Arcangeli [this message]
2013-06-05 15:10 ` [PATCH 2/7] mm: compaction: scan all memory with /proc/sys/vm/compact_memory Andrea Arcangeli
2013-06-05 19:34   ` Rik van Riel
2013-06-05 21:39   ` Rafael Aquini
2013-06-06  9:05   ` Mel Gorman
2013-06-05 15:10 ` [PATCH 3/7] mm: compaction: don't depend on kswapd to invoke reset_isolation_suitable Andrea Arcangeli
2013-06-05 19:49   ` Rik van Riel
2013-06-26 20:38     ` Andrea Arcangeli
2013-06-06  9:11   ` Mel Gorman
2013-06-26 20:48     ` Andrea Arcangeli
2013-06-06 12:47   ` Rafael Aquini
2013-06-05 15:10 ` [PATCH 4/7] mm: compaction: reset before initializing the scan cursors Andrea Arcangeli
2013-06-05 20:04   ` Rik van Riel
2013-06-06  9:14   ` Mel Gorman
2013-06-06 12:49   ` Rafael Aquini
2013-06-05 15:10 ` [PATCH 5/7] mm: compaction: increase the high order pages in the watermarks Andrea Arcangeli
2013-06-05 20:18   ` Rik van Riel
2013-06-28 22:14     ` Andrea Arcangeli
2013-06-06  9:19   ` Mel Gorman
2013-06-05 15:10 ` [PATCH 6/7] mm: compaction: export compact_zone_order() Andrea Arcangeli
2013-06-05 20:24   ` Rik van Riel
2013-06-05 15:10 ` [PATCH 7/7] mm: compaction: add compaction to zone_reclaim_mode Andrea Arcangeli
2013-06-05 22:21   ` Rik van Riel
2013-06-06 10:05   ` Mel Gorman
2013-07-11 16:02     ` Andrea Arcangeli
2013-07-12 12:26       ` Hush Bensen
2013-07-12 16:01         ` Andrea Arcangeli
2013-07-12 23:23           ` Hush Bensen
2013-07-15  9:16             ` Andrea Arcangeli
2013-07-12 23:57   ` Hush Bensen
2013-07-15  9:25     ` Andrea Arcangeli
2013-06-06  8:53 ` [PATCH 0/7] RFC: adding compaction to zone_reclaim_mode > 0 Mel Gorman
2013-06-06 10:09 ` Mel Gorman

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=20130626201011.GB28030@redhat.com \
    --to=aarcange@redhat.com \
    --cc=aquini@redhat.com \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=richard@arachsys.com \
    --cc=riel@redhat.com \
    --cc=shli@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.