From: Laurent Dufour <ldufour@linux.vnet.ibm.com>
To: daniel.m.jordan@oracle.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Cc: aaron.lu@intel.com, ak@linux.intel.com,
akpm@linux-foundation.org, Dave.Dice@oracle.com,
dave@stgolabs.net, khandual@linux.vnet.ibm.com, mgorman@suse.de,
mhocko@kernel.org, pasha.tatashin@oracle.com,
steven.sistare@oracle.com, yossi.lev@oracle.com
Subject: Re: [RFC PATCH v1 12/13] mm: split up release_pages into non-sentinel and sentinel passes
Date: Fri, 2 Feb 2018 15:40:09 +0100 [thread overview]
Message-ID: <3287f5ca-ab17-6437-c0fd-b867d90f8c1f@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180131230413.27653-13-daniel.m.jordan@oracle.com>
On 01/02/2018 00:04, daniel.m.jordan@oracle.com wrote:
> A common case in release_pages is for the 'pages' list to be in roughly
> the same order as they are in their LRU. With LRU batch locking, when a
> sentinel page is removed, an adjacent non-sentinel page must be promoted
> to a sentinel page to follow the locking scheme. So we can get behavior
> where nearly every page in the 'pages' array is treated as a sentinel
> page, hurting the scalability of this approach.
>
> To address this, split up release_pages into non-sentinel and sentinel
> passes so that the non-sentinel pages can be locked with an LRU batch
> lock before the sentinel pages are removed.
>
> For the prototype, just use a bitmap and a temporary outer loop to
> implement this.
>
> Performance numbers from a single microbenchmark at this point in the
> series are included in the next patch.
>
> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
> ---
> mm/swap.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/mm/swap.c b/mm/swap.c
> index fae766e035a4..a302224293ad 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -731,6 +731,7 @@ void lru_add_drain_all(void)
> put_online_cpus();
> }
>
> +#define LRU_BITMAP_SIZE 512
> /**
> * release_pages - batched put_page()
> * @pages: array of pages to release
> @@ -742,16 +743,32 @@ void lru_add_drain_all(void)
> */
> void release_pages(struct page **pages, int nr)
> {
> - int i;
> + int h, i;
> LIST_HEAD(pages_to_free);
> struct pglist_data *locked_pgdat = NULL;
> spinlock_t *locked_lru_batch = NULL;
> struct lruvec *lruvec;
> unsigned long uninitialized_var(flags);
> + DECLARE_BITMAP(lru_bitmap, LRU_BITMAP_SIZE);
> +
> + VM_BUG_ON(nr > LRU_BITMAP_SIZE);
While running your series rebased on v4.15-mmotm-2018-01-31-16-51, I'm
hitting this VM_BUG sometimes on a ppc64 system where page size is set to 64K.
In my case, nr=537 while LRU_BITMAP_SIZE is 512. Here is the stack trace
displayed :
kernel BUG at /local/laurent/work/glinux/mm/swap.c:728!
Oops: Exception in kernel mode, sig: 5 [#1]
LE SMP NR_CPUS=2048 NUMA pSeries
Modules linked in: pseries_rng rng_core vmx_crypto virtio_balloon ip_tables
x_tables autofs4 virtio_net virtio_blk virtio_pci virtio_ring virtio
CPU: 41 PID: 3485 Comm: cc1 Not tainted 4.15.0-mm1-lru+ #2
NIP: c0000000002b0784 LR: c0000000002b0780 CTR: c0000000007bab20
REGS: c0000005e126b740 TRAP: 0700 Not tainted (4.15.0-mm1-lru+)
MSR: 8000000000029033 <SF,EE,ME,IR,DR,RI,LE> CR: 28002422 XER: 20000000
CFAR: c000000000192ae4 SOFTE: 0
GPR00: c0000000002b0780 c0000005e126b9c0 c00000000103c100 000000000000001c
GPR04: c0000005ffc4ce38 c0000005ffc63d00 0000000000000000 0000000000000001
GPR08: 0000000000000007 c000000000ec3a4c 00000005fed90000 0000000000000000
GPR12: 0000000000002200 c00000000fd8cd00 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR24: c0000005e11ab980 0000000000000000 0000000000000000 c0000005e126ba60
GPR28: 0000000000000219 c0000005e126bc40 0000000000000000 c0000005ec5f0000
NIP [c0000000002b0784] release_pages+0x864/0x880
LR [c0000000002b0780] release_pages+0x860/0x880
Call Trace:
[c0000005e126b9c0] [c0000000002b0780] release_pages+0x860/0x880 (unreliable)
[c0000005e126bb30] [c00000000031da3c] free_pages_and_swap_cache+0x11c/0x150
[c0000005e126bb80] [c0000000002ef5f8] tlb_flush_mmu_free+0x68/0xa0
[c0000005e126bbc0] [c0000000002f1568] arch_tlb_finish_mmu+0x58/0xf0
[c0000005e126bbf0] [c0000000002f19d4] tlb_finish_mmu+0x34/0x60
[c0000005e126bc20] [c0000000003031e8] exit_mmap+0xd8/0x1d0
[c0000005e126bce0] [c0000000000f3188] mmput+0x78/0x160
[c0000005e126bd10] [c0000000000ff568] do_exit+0x348/0xd00
[c0000005e126bdd0] [c0000000000fffd8] do_group_exit+0x58/0xd0
[c0000005e126be10] [c00000000010006c] SyS_exit_group+0x1c/0x20
[c0000005e126be30] [c00000000000ba60] system_call+0x58/0x6c
Instruction dump:
3949ffff 4bfffdc8 3c62ffce 38a00200 f9c100e0 f9e100e8 386345e8 fa0100f0
fa2100f8 fa410100 4bee2329 60000000 <0fe00000> 3b400001 4bfff868 7d5d5378
---[ end trace 55b1651f9d92f14f ]---
>
> + bitmap_zero(lru_bitmap, nr);
> +
> + for (h = 0; h < 2; h++) {
> for (i = 0; i < nr; i++) {
> struct page *page = pages[i];
>
> + if (h == 0) {
> + if (PageLRU(page) && page->lru_sentinel) {
> + bitmap_set(lru_bitmap, i, 1);
> + continue;
> + }
> + } else {
> + if (!test_bit(i, lru_bitmap))
> + continue;
> + }
> +
> if (is_huge_zero_page(page))
> continue;
>
> @@ -798,6 +815,7 @@ void release_pages(struct page **pages, int nr)
>
> list_add(&page->lru, &pages_to_free);
> }
> + }
> if (locked_lru_batch) {
> lru_batch_unlock(NULL, &locked_lru_batch, &locked_pgdat,
> &flags);
>
--
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>
next prev parent reply other threads:[~2018-02-02 14:40 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 23:04 [RFC PATCH v1 00/13] lru_lock scalability daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 01/13] mm: add a percpu_pagelist_batch sysctl interface daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 02/13] mm: allow compaction to be disabled daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 03/13] mm: add lock array to pgdat and batch fields to struct page daniel.m.jordan
2018-02-01 22:50 ` Tim Chen
2018-02-02 4:29 ` Daniel Jordan
2018-01-31 23:04 ` [RFC PATCH v1 04/13] mm: introduce struct lru_list_head in lruvec to hold per-LRU batch info daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 05/13] mm: add batching logic to add/delete/move API's daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 06/13] mm: add lru_[un]lock_all APIs daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 07/13] mm: convert to-be-refactored lru_lock callsites to lock-all API daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 08/13] mm: temporarily convert " daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 09/13] mm: introduce add-only version of pagevec_lru_move_fn daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 10/13] mm: add LRU batch lock API's daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 11/13] mm: use lru_batch locking in release_pages daniel.m.jordan
2018-01-31 23:04 ` [RFC PATCH v1 12/13] mm: split up release_pages into non-sentinel and sentinel passes daniel.m.jordan
2018-02-02 14:40 ` Laurent Dufour [this message]
2018-02-02 17:00 ` Laurent Dufour
2018-02-06 17:47 ` Daniel Jordan
2018-02-05 4:58 ` [lkp-robot] [mm] 44b163e12f: kernel_BUG_at_mm/swap.c kernel test robot
2018-01-31 23:04 ` [RFC PATCH v1 13/13] mm: splice local lists onto the front of the LRU daniel.m.jordan
2018-02-01 23:30 ` Tim Chen
2018-02-02 5:17 ` Daniel Jordan
2018-02-02 5:21 ` Aaron Lu
2018-02-06 17:38 ` Daniel Jordan
2018-02-02 15:22 ` Laurent Dufour
2018-02-06 18:18 ` Daniel Jordan
2018-02-01 15:54 ` [RFC PATCH v1 00/13] lru_lock scalability Steven Whitehouse
2018-02-02 4:18 ` Daniel Jordan
2018-02-02 10:50 ` Steven Whitehouse
2018-02-08 23:36 ` Andrew Morton
2018-02-13 21:07 ` Daniel Jordan
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=3287f5ca-ab17-6437-c0fd-b867d90f8c1f@linux.vnet.ibm.com \
--to=ldufour@linux.vnet.ibm.com \
--cc=Dave.Dice@oracle.com \
--cc=aaron.lu@intel.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=daniel.m.jordan@oracle.com \
--cc=dave@stgolabs.net \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=pasha.tatashin@oracle.com \
--cc=steven.sistare@oracle.com \
--cc=yossi.lev@oracle.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