All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] Use RCU to stabilize page counts
@ 2011-08-19  7:48 ` Michel Lespinasse
  0 siblings, 0 replies; 109+ messages in thread
From: Michel Lespinasse @ 2011-08-19  7:48 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel
  Cc: Andrea Arcangeli, Hugh Dickins, Minchan Kim, Johannes Weiner,
	Rik van Riel, Mel Gorman, KOSAKI Motohiro, Shaohua Li

include/linux/pagemap.h describes the protocol one should use to get pages
from page cache - one can't know if the reference they get will be on the
desired page, so newly allocated pages might see elevated reference counts,
but using RCU this effect can be limited in time to one RCU grace period.

For this protocol to work, every call site of get_page_unless_zero() has to
participate, and this was not previously enforced.

Patches 1-3 convert some get_page_unless_zero() call sites to use the proper
RCU protocol as described in pagemap.h

Patches 4-5 convert some get_page_unless_zero() call sites to just call
get_page()

Patch 6 asserts that every remaining get_page_unless_zero() call site should
participate in the RCU protocol. Well, not actually all of them -
__isolate_rcu_page() is exempted because it holds the zone LRU lock which
would prevent the given page from getting entirely freed, and a few others
related to hwpoison, memory hotplug and memory failure are exempted because
I haven't been able to figure out what to do.

Patch 7 is a placeholder for an RCU API extension we have been talking about
with Paul McKenney. The idea is to record an initial time as an opaque cookie,
and to be able to determine later on if an rcu grace period has elapsed since
that initial time.

Patch 8 adds wrapper functions to store an RCU cookie into compound pages.

Patch 9 makes use of new RCU API, as well as the prior fixes from patches 1-6,
to ensure tail page counts are stable while we split THP pages. This fixes a
(rather theorical, not actually been observed) race condition where THP page
splitting could result in incorrect page counts if THP page allocation and
splitting both occur while another thread tries to run get_page_unless_zero
on a single page that got re-allocated as THP tail page.


The patches have received only a limited amount of testing; however I
believe patches 1-6 to be sane and I would like them to get more
exposure, maybe as part of andrew's -mm tree.


Besides that, this proposal is also to sync up with Paul regarding the RCU
functionality :)


Michel Lespinasse (9):
  mm: rcu read lock for getting reference on pages in
    migration_entry_wait()
  mm: avoid calling get_page_unless_zero() when charging cgroups
  mm: rcu read lock when getting from tail to head page
  mm: use get_page in deactivate_page()
  kvm: use get_page instead of get_page_unless_zero
  mm: assert that get_page_unless_zero() callers hold the rcu lock
  rcu: rcu_get_gp_cookie() / rcu_gp_cookie_elapsed() stand-ins
  mm: add API for setting a grace period cookie on compound pages
  mm: make sure tail page counts are stable before splitting THP pages

 arch/x86/kvm/mmu.c       |    3 +--
 include/linux/mm.h       |   38 +++++++++++++++++++++++++++++++++++++-
 include/linux/mm_types.h |    6 +++++-
 include/linux/pagemap.h  |    1 +
 include/linux/rcupdate.h |   35 +++++++++++++++++++++++++++++++++++
 mm/huge_memory.c         |   33 +++++++++++++++++++++++++++++----
 mm/hwpoison-inject.c     |    2 +-
 mm/ksm.c                 |    4 ++++
 mm/memcontrol.c          |   20 ++++++++++----------
 mm/memory-failure.c      |    6 +++---
 mm/memory_hotplug.c      |    2 +-
 mm/migrate.c             |    3 +++
 mm/page_alloc.c          |    1 +
 mm/swap.c                |   22 ++++++++++++++--------
 mm/vmscan.c              |    7 ++++++-
 15 files changed, 151 insertions(+), 32 deletions(-)

-- 
1.7.3.1


^ permalink raw reply	[flat|nested] 109+ messages in thread

end of thread, other threads:[~2011-10-17 22:45 UTC | newest]

Thread overview: 109+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19  7:48 [PATCH 0/9] Use RCU to stabilize page counts Michel Lespinasse
2011-08-19  7:48 ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 1/9] mm: rcu read lock for getting reference on pages in migration_entry_wait() Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 2/9] mm: avoid calling get_page_unless_zero() when charging cgroups Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 3/9] mm: rcu read lock when getting from tail to head page Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 4/9] mm: use get_page in deactivate_page() Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 5/9] kvm: use get_page instead of get_page_unless_zero Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 6/9] mm: assert that get_page_unless_zero() callers hold the rcu lock Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19 23:28   ` Andi Kleen
2011-08-19 23:28     ` Andi Kleen
2011-08-19  7:48 ` [PATCH 7/9] rcu: rcu_get_gp_cookie() / rcu_gp_cookie_elapsed() stand-ins Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 8/9] mm: add API for setting a grace period cookie on compound pages Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:48 ` [PATCH 9/9] mm: make sure tail page counts are stable before splitting THP pages Michel Lespinasse
2011-08-19  7:48   ` Michel Lespinasse
2011-08-19  7:53 ` [PATCH 0/9] Use RCU to stabilize page counts Michel Lespinasse
2011-08-19  7:53   ` Michel Lespinasse
2011-08-22 21:33 ` [PATCH] thp: tail page refcounting fix Andrea Arcangeli
2011-08-22 21:33   ` Andrea Arcangeli
2011-08-23 14:55   ` Andrea Arcangeli
2011-08-23 14:55     ` Andrea Arcangeli
2011-08-23 16:45   ` Minchan Kim
2011-08-23 16:45     ` Minchan Kim
2011-08-23 16:54     ` Andrea Arcangeli
2011-08-23 16:54       ` Andrea Arcangeli
2011-08-23 19:52   ` Michel Lespinasse
2011-08-23 19:52     ` Michel Lespinasse
2011-08-24  0:09     ` Andrea Arcangeli
2011-08-24  0:09       ` Andrea Arcangeli
2011-08-24  0:27       ` Andrea Arcangeli
2011-08-24  0:27         ` Andrea Arcangeli
2011-08-24 13:34         ` [PATCH] thp: tail page refcounting fix #2 Andrea Arcangeli
2011-08-24 13:34           ` Andrea Arcangeli
2011-08-26  6:24           ` Michel Lespinasse
2011-08-26  6:24             ` Michel Lespinasse
2011-08-26 16:10             ` Andrea Arcangeli
2011-08-26 16:10               ` Andrea Arcangeli
2011-08-26 18:54               ` [PATCH] thp: tail page refcounting fix #3 Andrea Arcangeli
2011-08-26 18:54                 ` Andrea Arcangeli
2011-08-27  9:41                 ` Michel Lespinasse
2011-08-27  9:41                   ` Michel Lespinasse
2011-08-27 17:34                   ` [PATCH] thp: tail page refcounting fix #4 Andrea Arcangeli
2011-08-27 17:34                     ` Andrea Arcangeli
2011-08-29  4:20                     ` Minchan Kim
2011-08-29  4:20                       ` Minchan Kim
2011-09-01 15:24                       ` [PATCH] thp: tail page refcounting fix #5 Andrea Arcangeli
2011-09-01 15:24                         ` Andrea Arcangeli
2011-09-01 22:27                         ` Michel Lespinasse
2011-09-01 22:27                           ` Michel Lespinasse
2011-09-01 23:28                         ` Andrew Morton
2011-09-01 23:28                           ` Andrew Morton
2011-09-01 23:45                           ` Andi Kleen
2011-09-01 23:45                             ` Andi Kleen
2011-09-02  0:20                             ` Andrea Arcangeli
2011-09-02  0:20                               ` Andrea Arcangeli
2011-09-02  1:17                               ` Andi Kleen
2011-09-02  1:17                                 ` Andi Kleen
2011-09-02  0:03                         ` Andrew Morton
2011-09-02  0:03                           ` Andrew Morton
2011-09-08 16:51                           ` [PATCH] thp: tail page refcounting fix #6 Andrea Arcangeli
2011-09-08 16:51                             ` Andrea Arcangeli
2011-09-23 15:57                             ` Peter Zijlstra
2011-09-23 15:57                               ` Peter Zijlstra
2011-09-30 13:58                               ` Andrea Arcangeli
2011-09-30 13:58                                 ` Andrea Arcangeli
2011-10-16 20:37                               ` thp: gup_fast ppc tail refcounting [was Re: [PATCH] thp: tail page refcounting fix #6] Andrea Arcangeli
2011-10-16 20:37                               ` [PATCH 1/4] powerpc: remove superfluous PageTail checks on the pte gup_fast Andrea Arcangeli
2011-10-16 20:37                               ` [PATCH 2/4] powerpc: get_hugepte() don't put_page() the wrong page Andrea Arcangeli
2011-10-16 20:37                               ` [PATCH 3/4] powerpc: gup_hugepte() avoid to free the head page too many times Andrea Arcangeli
2011-10-16 20:37                               ` [PATCH 4/4] powerpc: gup_hugepte() support THP based tail recounting Andrea Arcangeli
2011-10-16 20:40                               ` thp: gup_fast ppc tail refcounting [was Re: [PATCH] thp: tail page refcounting fix #6] Andrea Arcangeli
2011-10-16 20:40                                 ` Andrea Arcangeli
2011-10-16 20:40                               ` [PATCH 1/4] powerpc: remove superfluous PageTail checks on the pte gup_fast Andrea Arcangeli
2011-10-16 20:40                                 ` Andrea Arcangeli
2011-10-16 20:40                               ` [PATCH 2/4] powerpc: get_hugepte() don't put_page() the wrong page Andrea Arcangeli
2011-10-16 20:40                                 ` Andrea Arcangeli
2011-10-16 20:40                               ` [PATCH 3/4] powerpc: gup_hugepte() avoid to free the head page too many times Andrea Arcangeli
2011-10-16 20:40                                 ` Andrea Arcangeli
2011-10-16 20:40                               ` [PATCH 4/4] powerpc: gup_hugepte() support THP based tail recounting Andrea Arcangeli
2011-10-16 20:40                                 ` Andrea Arcangeli
2011-10-17 14:41                               ` thp: gup_fast s390/sparc tail refcounting [was Re: [PATCH] thp: tail page refcounting fix #6] Andrea Arcangeli
2011-10-17 14:41                                 ` Andrea Arcangeli
2011-10-17 14:41                                 ` [PATCH 1/3] s390: gup_huge_pmd() support THP tail recounting Andrea Arcangeli
2011-10-17 14:41                                   ` Andrea Arcangeli
2011-10-17 14:41                                 ` [PATCH 2/3] sparc: gup_pte_range() support THP based " Andrea Arcangeli
2011-10-17 14:41                                   ` Andrea Arcangeli
2011-10-17 22:44                                   ` David Miller
2011-10-17 22:44                                     ` David Miller
2011-10-17 14:41                                 ` [PATCH 3/3] thp: share get_huge_page_tail() Andrea Arcangeli
2011-10-17 14:41                                   ` Andrea Arcangeli
2011-10-17 21:32                               ` fix two more s390/sparc gup_fast bugs Andrea Arcangeli
2011-10-17 21:32                                 ` Andrea Arcangeli
2011-10-17 21:32                                 ` [PATCH 1/2] s390: gup_huge_pmd() return 0 if pte changes Andrea Arcangeli
2011-10-17 21:32                                   ` Andrea Arcangeli
2011-10-17 21:32                                 ` [PATCH 2/2] powerpc: " Andrea Arcangeli
2011-10-17 21:32                                   ` Andrea Arcangeli
2011-08-29 22:40                     ` [PATCH] thp: tail page refcounting fix #4 Michel Lespinasse
2011-08-29 22:40                       ` Michel Lespinasse
2011-08-29 23:30                       ` Andrea Arcangeli
2011-08-29 23:30                         ` Andrea Arcangeli
2011-08-26 19:28             ` [PATCH] thp: tail page refcounting fix #2 Andrea Arcangeli
2011-08-26 19:28               ` Andrea Arcangeli

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.