linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@suse.de>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Minchan Kim <minchan@kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: [PATCH 0/6] close pageblock_migratetype and pageblock_skip races
Date: Fri, 28 Feb 2014 15:14:58 +0100	[thread overview]
Message-ID: <1393596904-16537-1-git-send-email-vbabka@suse.cz> (raw)

Hello,

this series follows on the discussions of Joonsoo Kim's series
"improve robustness on handling migratetype" https://lkml.org/lkml/2014/1/9/29
The goal is to close the race of get/set_pageblock_migratetype (and _skip)
which Joonsoo found in the code and I've observed in my further compaction
series development.

Instead of a new seqlock for the pageblock bitmap, my series extends the
coverage of zone->lock where possible (patch 1) and deals with the races where
it's not feasible to lock (patches 2-4), as suggested by Mel in the original
thread.

Testing of patches 1-4 made me realize that a race between setting migratetype
and set/clear_pageblock_skip is also an issue because all the 4 bits are packed
within the same byte for each pair of pageblocks and the bit operations are not
atomic. Thus and update to the skip bit may lose racing updates to some bits
comprising migratetype and break it. Patch 5 reduces the amount of unneeded
set_pageblock_skip calls, and patch 6 fixes the race by making the bit
operations atomic, including reasons for picking this solution instead of
using zone->lock also for set_pageblock_skip().

Vlastimil

Vlastimil Babka (6):
  mm: call get_pageblock_migratetype() under zone->lock where possible
  mm: add get_pageblock_migratetype_nolock() for cases where locking is
    undesirable
  mm: add is_migrate_isolate_page_nolock() for cases where locking is
    undesirable
  mm: add set_pageblock_migratetype_nolock() for calls outside
    zone->lock
  mm: compaction: do not set pageblock skip bit when already set
  mm: use atomic bit operations in set_pageblock_flags_group()

 include/linux/mmzone.h         | 24 +++++++++++++++
 include/linux/page-isolation.h | 24 +++++++++++++++
 mm/compaction.c                | 18 ++++++++---
 mm/hugetlb.c                   |  2 +-
 mm/memory-failure.c            |  3 +-
 mm/page_alloc.c                | 69 ++++++++++++++++++++++++++++--------------
 mm/page_isolation.c            | 23 ++++++++------
 mm/vmstat.c                    |  2 +-
 8 files changed, 126 insertions(+), 39 deletions(-)

-- 
1.8.4.5

--
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:[~2014-02-28 14:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 14:14 Vlastimil Babka [this message]
2014-02-28 14:14 ` [PATCH 1/6] mm: call get_pageblock_migratetype() under zone->lock where possible Vlastimil Babka
2014-02-28 14:15 ` [PATCH 2/6] mm: add get_pageblock_migratetype_nolock() for cases where locking is undesirable Vlastimil Babka
2014-03-03  8:22   ` Joonsoo Kim
2014-03-03 13:54     ` Vlastimil Babka
2014-03-04  0:55       ` Joonsoo Kim
2014-03-04 12:16         ` Vlastimil Babka
2014-03-05  0:29           ` Joonsoo Kim
2014-03-05  0:37   ` Joonsoo Kim
2014-02-28 14:15 ` [PATCH 3/6] mm: add is_migrate_isolate_page_nolock() " Vlastimil Babka
2014-03-05  0:39   ` Joonsoo Kim
2014-02-28 14:15 ` [PATCH 4/6] mm: add set_pageblock_migratetype_nolock() for calls outside zone->lock Vlastimil Babka
2014-02-28 14:15 ` [PATCH 5/6] mm: compaction: do not set pageblock skip bit when already set Vlastimil Babka
2014-02-28 14:15 ` [PATCH 6/6] mm: use atomic bit operations in set_pageblock_flags_group() Vlastimil Babka
2014-03-03  8:28   ` Joonsoo Kim
2014-03-03 12:46     ` Vlastimil Babka

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=1393596904-16537-1-git-send-email-vbabka@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.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;
as well as URLs for NNTP newsgroup(s).