From: Mel Gorman <mgorman@suse.de>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Linux-Stable <stable@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, Mel Gorman <mgorman@suse.de>
Subject: [PATCH 90/97] vmalloc: use rcu list iterator to reduce vmap_area_lock contention
Date: Thu, 28 Aug 2014 19:35:38 +0100 [thread overview]
Message-ID: <1409250945-30874-91-git-send-email-mgorman@suse.de> (raw)
In-Reply-To: <1409250945-30874-1-git-send-email-mgorman@suse.de>
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
commit 474750aba88817c53f39424e5567b8e4acc4b39b upstream.
Richard Yao reported a month ago that his system have a trouble with
vmap_area_lock contention during performance analysis by /proc/meminfo.
Andrew asked why his analysis checks /proc/meminfo stressfully, but he
didn't answer it.
https://lkml.org/lkml/2014/4/10/416
Although I'm not sure that this is right usage or not, there is a
solution reducing vmap_area_lock contention with no side-effect. That
is just to use rcu list iterator in get_vmalloc_info().
rcu can be used in this function because all RCU protocol is already
respected by writers, since Nick Piggin commit db64fe02258f1 ("mm:
rewrite vmap layer") back in linux-2.6.28
Specifically :
insertions use list_add_rcu(),
deletions use list_del_rcu() and kfree_rcu().
Note the rb tree is not used from rcu reader (it would not be safe),
only the vmap_area_list has full RCU protection.
Note that __purge_vmap_area_lazy() already uses this rcu protection.
rcu_read_lock();
list_for_each_entry_rcu(va, &vmap_area_list, list) {
if (va->flags & VM_LAZY_FREE) {
if (va->va_start < *start)
*start = va->va_start;
if (va->va_end > *end)
*end = va->va_end;
nr += (va->va_end - va->va_start) >> PAGE_SHIFT;
list_add_tail(&va->purge_list, &valist);
va->flags |= VM_LAZY_FREEING;
va->flags &= ~VM_LAZY_FREE;
}
}
rcu_read_unlock();
Peter:
: While rcu list traversal over the vmap_area_list is safe, this may
: arrive at different results than the spinlocked version. The rcu list
: traversal version will not be a 'snapshot' of a single, valid instant
: of the entire vmap_area_list, but rather a potential amalgam of
: different list states.
Joonsoo:
: Yes, you are right, but I don't think that we should be strict here.
: Meminfo is already not a 'snapshot' at specific time. While we try to get
: certain stats, the other stats can change. And, although we may arrive at
: different results than the spinlocked version, the difference would not be
: large and would not make serious side-effect.
[edumazet@google.com: add more commit description]
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reported-by: Richard Yao <ryao@gentoo.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Zhang Yanfei <zhangyanfei.yes@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
---
mm/vmalloc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index e2be0f8..060dc36 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2685,14 +2685,14 @@ void get_vmalloc_info(struct vmalloc_info *vmi)
prev_end = VMALLOC_START;
- spin_lock(&vmap_area_lock);
+ rcu_read_lock();
if (list_empty(&vmap_area_list)) {
vmi->largest_chunk = VMALLOC_TOTAL;
goto out;
}
- list_for_each_entry(va, &vmap_area_list, list) {
+ list_for_each_entry_rcu(va, &vmap_area_list, list) {
unsigned long addr = va->va_start;
/*
@@ -2719,7 +2719,7 @@ void get_vmalloc_info(struct vmalloc_info *vmi)
vmi->largest_chunk = VMALLOC_END - prev_end;
out:
- spin_unlock(&vmap_area_lock);
+ rcu_read_unlock();
}
#endif
--
1.8.4.5
next prev parent reply other threads:[~2014-08-28 18:44 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 18:34 [PATCH 00/97] Misc series of functional/performance fixes for 3.12-stable Mel Gorman
2014-08-28 18:34 ` [PATCH 01/97] mm: thp: cleanup: mv alloc_hugepage to better place Mel Gorman
2014-08-28 18:34 ` [PATCH 02/97] mm: thp: khugepaged: add policy for finding target node Mel Gorman
2014-08-28 18:34 ` [PATCH 03/97] slab: correct pfmemalloc check Mel Gorman
2014-08-28 18:34 ` [PATCH 04/97] mm: prevent setting of a value less than 0 to min_free_kbytes Mel Gorman
2014-08-28 18:34 ` [PATCH 05/97] mm: fix bad rss-counter if remap_file_pages raced migration Mel Gorman
2014-08-28 18:34 ` [PATCH 06/97] hugetlb: ensure hugepage access is denied if hugepages are not supported Mel Gorman
2014-08-28 18:34 ` [PATCH 07/97] mm: exclude memoryless nodes from zone_reclaim Mel Gorman
2014-08-28 18:34 ` [PATCH 08/97] mm, thp: do not allow thp faults to avoid cpuset restrictions Mel Gorman
2014-09-26 9:53 ` Jiri Slaby
2014-10-13 15:17 ` Mel Gorman
2014-08-28 18:34 ` [PATCH 09/97] swap: change swap_info singly-linked list to list_head Mel Gorman
2014-08-28 18:34 ` [PATCH 10/97] lib/plist: add helper functions Mel Gorman
2014-08-28 18:34 ` [PATCH 11/97] lib/plist: add plist_requeue Mel Gorman
2014-08-28 18:34 ` [PATCH 12/97] swap: change swap_list_head to plist, add swap_avail_head Mel Gorman
2014-08-28 18:34 ` [PATCH 13/97] readahead: fix sequential read cache miss detection Mel Gorman
2014-08-28 18:34 ` [PATCH 14/97] mm: get rid of unnecessary overhead of trace_mm_page_alloc_extfrag() Mel Gorman
2014-08-28 18:34 ` [PATCH 15/97] mm: __rmqueue_fallback() should respect pageblock type Mel Gorman
2014-08-28 18:34 ` [PATCH 16/97] mm, x86: Account for TLB flushes only when debugging Mel Gorman
2014-08-28 18:34 ` [PATCH 17/97] x86/mm: Clean up inconsistencies when flushing TLB ranges Mel Gorman
2014-08-28 18:34 ` [PATCH 18/97] x86/mm: Eliminate redundant page table walk during TLB range flushing Mel Gorman
2014-08-28 18:34 ` [PATCH 19/97] mm: compaction: trace compaction begin and end Mel Gorman
2014-08-28 18:34 ` [PATCH 20/97] mm: compaction: encapsulate defer reset logic Mel Gorman
2014-08-28 18:34 ` [PATCH 21/97] mm: compaction: do not mark unmovable pageblocks as skipped in async compaction Mel Gorman
2014-08-28 18:34 ` [PATCH 22/97] mm: compaction: reset scanner positions immediately when they meet Mel Gorman
2014-08-28 18:34 ` [PATCH 23/97] swap: add a simple detector for inappropriate swapin readahead Mel Gorman
2014-08-28 18:34 ` [PATCH 24/97] mm: vmscan: shrink all slab objects if tight on memory Mel Gorman
2014-08-28 18:34 ` [PATCH 25/97] mm: vmscan: call NUMA-unaware shrinkers irrespective of nodemask Mel Gorman
2014-08-28 18:34 ` [PATCH 26/97] mm: get rid of unnecessary pageblock scanning in setup_zone_migrate_reserve Mel Gorman
2014-08-28 18:34 ` [PATCH 27/97] mm, compaction: avoid isolating pinned pages Mel Gorman
2014-08-28 18:34 ` [PATCH 28/97] mm/compaction: disallow high-order page for migration target Mel Gorman
2014-08-28 18:34 ` [PATCH 29/97] mm/compaction: do not call suitable_migration_target() on every page Mel Gorman
2014-08-28 18:34 ` [PATCH 30/97] mm/compaction: change the timing to check to drop the spinlock Mel Gorman
2014-08-28 18:34 ` [PATCH 31/97] mm/compaction: check pageblock suitability once per pageblock Mel Gorman
2014-08-28 18:34 ` [PATCH 32/97] mm/compaction: clean-up code on success of ballon isolation Mel Gorman
2014-08-28 18:34 ` [PATCH 33/97] mm, compaction: determine isolation mode only once Mel Gorman
2014-08-28 18:34 ` [PATCH 34/97] mm, compaction: ignore pageblock skip when manually invoking compaction Mel Gorman
2014-08-28 18:34 ` [PATCH 35/97] mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages Mel Gorman
2014-08-28 18:34 ` [PATCH 36/97] mm: optimize put_mems_allowed() usage Mel Gorman
2014-08-28 18:34 ` [PATCH 37/97] mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT Mel Gorman
2014-08-28 18:34 ` [PATCH 38/97] mm: vmscan: respect NUMA policy mask when shrinking slab on direct reclaim Mel Gorman
2014-08-28 18:34 ` [PATCH 39/97] mm: vmscan: shrink_slab: rename max_pass -> freeable Mel Gorman
2014-08-28 18:34 ` [PATCH 40/97] vmscan: reclaim_clean_pages_from_list() must use mod_zone_page_state() Mel Gorman
2014-08-28 18:34 ` [PATCH 41/97] mm: per-thread vma caching Mel Gorman
2014-08-28 18:34 ` [PATCH 42/97] mm: don't pointlessly use BUG_ON() for sanity check Mel Gorman
2014-08-28 18:34 ` [PATCH 43/97] lib: radix-tree: add radix_tree_delete_item() Mel Gorman
2014-08-28 18:34 ` [PATCH 44/97] mm: shmem: save one radix tree lookup when truncating swapped pages Mel Gorman
2014-08-28 18:34 ` [PATCH 45/97] mm: filemap: move radix tree hole searching here Mel Gorman
2014-08-28 18:34 ` [PATCH 46/97] mm + fs: prepare for non-page entries in page cache radix trees Mel Gorman
2014-08-28 18:34 ` [PATCH 47/97] mm: madvise: fix MADV_WILLNEED on shmem swapouts Mel Gorman
2014-08-28 18:34 ` [PATCH 48/97] mm: remove read_cache_page_async() Mel Gorman
2014-08-28 18:34 ` [PATCH 49/97] callers of iov_copy_from_user_atomic() don't need pagecache_disable() Mel Gorman
2014-08-28 18:34 ` [PATCH 50/97] mm/readahead.c: inline ra_submit Mel Gorman
2014-08-28 18:34 ` [PATCH 51/97] mm/compaction: clean up unused code lines Mel Gorman
2014-08-28 18:35 ` [PATCH 52/97] mm/compaction: cleanup isolate_freepages() Mel Gorman
2014-08-28 18:35 ` [PATCH 53/97] mm, migration: add destination page freeing callback Mel Gorman
2014-08-28 18:35 ` [PATCH 54/97] mm, compaction: return failed migration target pages back to freelist Mel Gorman
2014-08-28 18:35 ` [PATCH 55/97] mm, compaction: add per-zone migration pfn cache for async compaction Mel Gorman
2014-08-28 18:35 ` [PATCH 56/97] mm, compaction: embed migration mode in compact_control Mel Gorman
2014-08-28 18:35 ` [PATCH 57/97] mm, compaction: terminate async compaction when rescheduling Mel Gorman
2014-08-28 18:35 ` [PATCH 58/97] mm/compaction: do not count migratepages when unnecessary Mel Gorman
2014-08-28 18:35 ` [PATCH 59/97] mm/compaction: avoid rescanning pageblocks in isolate_freepages Mel Gorman
2014-08-28 18:35 ` [PATCH 60/97] mm, compaction: properly signal and act upon lock and need_sched() contention Mel Gorman
2014-08-28 18:35 ` [PATCH 61/97] x86/mm: In the PTE swapout page reclaim case clear the accessed bit instead of flushing the TLB Mel Gorman
2014-08-28 18:35 ` [PATCH 62/97] mm: fix direct reclaim writeback regression Mel Gorman
2014-08-28 18:35 ` [PATCH 63/97] fs/superblock: unregister sb shrinker before ->kill_sb() Mel Gorman
2014-08-28 18:35 ` [PATCH 64/97] fs/superblock: avoid locking counting inodes and dentries before reclaiming them Mel Gorman
2014-08-28 18:35 ` [PATCH 65/97] mm: vmscan: use proportional scanning during direct reclaim and full scan at DEF_PRIORITY Mel Gorman
2014-08-28 18:35 ` [PATCH 66/97] mm/page_alloc: prevent MIGRATE_RESERVE pages from being misplaced Mel Gorman
2014-08-28 18:35 ` [PATCH 67/97] mm/swap.c: clean up *lru_cache_add* functions Mel Gorman
2014-08-28 18:35 ` [PATCH 68/97] mm: page_alloc: do not update zlc unless the zlc is active Mel Gorman
2014-08-28 18:35 ` [PATCH 69/97] mm: page_alloc: do not treat a zone that cannot be used for dirty pages as "full" Mel Gorman
2014-08-28 18:35 ` [PATCH 70/97] include/linux/jump_label.h: expose the reference count Mel Gorman
2014-08-28 18:35 ` [PATCH 71/97] mm: page_alloc: use jump labels to avoid checking number_of_cpusets Mel Gorman
2014-08-28 18:35 ` [PATCH 72/97] mm: page_alloc: calculate classzone_idx once from the zonelist ref Mel Gorman
2014-08-28 18:35 ` [PATCH 73/97] mm: page_alloc: only check the zone id check if pages are buddies Mel Gorman
2014-08-28 18:35 ` [PATCH 74/97] mm: page_alloc: only check the alloc flags and gfp_mask for dirty once Mel Gorman
2014-08-28 18:35 ` [PATCH 75/97] mm: page_alloc: take the ALLOC_NO_WATERMARK check out of the fast path Mel Gorman
2014-08-28 18:35 ` [PATCH 76/97] mm: page_alloc: use unsigned int for order in more places Mel Gorman
2014-08-28 18:35 ` [PATCH 77/97] mm: page_alloc: reduce number of times page_to_pfn is called Mel Gorman
2014-08-28 18:35 ` [PATCH 78/97] mm: page_alloc: convert hot/cold parameter and immediate callers to bool Mel Gorman
2014-08-28 18:35 ` [PATCH 79/97] mm: page_alloc: lookup pageblock migratetype with IRQs enabled during free Mel Gorman
2014-08-28 18:35 ` [PATCH 80/97] mm: shmem: avoid atomic operation during shmem_getpage_gfp Mel Gorman
2014-08-28 18:35 ` [PATCH 81/97] mm: do not use atomic operations when releasing pages Mel Gorman
2014-08-28 18:35 ` [PATCH 82/97] mm: do not use unnecessary atomic operations when adding pages to the LRU Mel Gorman
2014-08-28 18:35 ` [PATCH 83/97] fs: buffer: do not use unnecessary atomic operations when discarding buffers Mel Gorman
2014-08-28 18:35 ` [PATCH 84/97] mm: non-atomically mark page accessed during page cache allocation where possible Mel Gorman
2014-08-28 18:35 ` [PATCH 85/97] mm: avoid unnecessary atomic operations during end_page_writeback() Mel Gorman
2014-08-28 18:35 ` [PATCH 86/97] shmem: fix init_page_accessed use to stop !PageLRU bug Mel Gorman
2014-08-28 18:35 ` [PATCH 87/97] mm/memory.c: use entry = ACCESS_ONCE(*pte) in handle_pte_fault() Mel Gorman
2014-08-28 18:35 ` [PATCH 88/97] mm, thp: only collapse hugepages to nodes with affinity for zone_reclaim_mode Mel Gorman
2014-08-28 18:35 ` [PATCH 89/97] mm: make copy_pte_range static again Mel Gorman
2014-08-28 18:35 ` Mel Gorman [this message]
2014-08-28 18:35 ` [PATCH 91/97] memcg, vmscan: Fix forced scan of anonymous pages Mel Gorman
2014-08-28 18:35 ` [PATCH 92/97] mm: pagemap: avoid unnecessary overhead when tracepoints are deactivated Mel Gorman
2014-08-28 18:35 ` [PATCH 93/97] mm: rearrange zone fields into read-only, page alloc, statistics and page reclaim lines Mel Gorman
2014-08-28 18:35 ` [PATCH 94/97] mm: move zone->pages_scanned into a vmstat counter Mel Gorman
2014-08-28 18:35 ` [PATCH 95/97] mm: vmscan: only update per-cpu thresholds for online CPU Mel Gorman
2014-08-28 18:35 ` [PATCH 96/97] mm: page_alloc: abort fair zone allocation policy when remotes nodes are encountered Mel Gorman
2014-08-28 18:35 ` [PATCH 97/97] mm: page_alloc: reduce cost of the fair zone allocation policy Mel Gorman
2015-01-28 1:13 ` [PATCH 00/97] Misc series of functional/performance fixes for 3.12-stable Greg KH
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=1409250945-30874-91-git-send-email-mgorman@suse.de \
--to=mgorman@suse.de \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®