From: Jan Kara <jack@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Jan Kara <jack@suse.cz>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH 2/6] mm: workingset: turn shadow node shrinker bugs into warnings
Date: Tue, 8 Nov 2016 10:57:25 +0100 [thread overview]
Message-ID: <20161108095725.GI32353@quack2.suse.cz> (raw)
In-Reply-To: <20161107190741.3619-3-hannes@cmpxchg.org>
On Mon 07-11-16 14:07:37, Johannes Weiner wrote:
> When the shadow page shrinker tries to reclaim a radix tree node but
> finds it in an unexpected state - it should contain no pages, and
> non-zero shadow entries - there is no need to kill the executing task
> or even the entire system. Warn about the invalid state, then leave
> that tree node be. Simply don't put it back on the shadow LRU for
> future reclaim and move on.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/workingset.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/mm/workingset.c b/mm/workingset.c
> index 617475f529f4..3cfc61d84a52 100644
> --- a/mm/workingset.c
> +++ b/mm/workingset.c
> @@ -418,23 +418,27 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
> * no pages, so we expect to be able to remove them all and
> * delete and free the empty node afterwards.
> */
> - BUG_ON(!workingset_node_shadows(node));
> - BUG_ON(workingset_node_pages(node));
> -
> + if (WARN_ON_ONCE(!workingset_node_shadows(node)))
> + goto out_invalid;
> + if (WARN_ON_ONCE(workingset_node_pages(node)))
> + goto out_invalid;
> for (i = 0; i < RADIX_TREE_MAP_SIZE; i++) {
> if (node->slots[i]) {
> - BUG_ON(!radix_tree_exceptional_entry(node->slots[i]));
> + if (WARN_ON_ONCE(!radix_tree_exceptional_entry(node->slots[i])))
> + goto out_invalid;
> + if (WARN_ON_ONCE(!mapping->nrexceptional))
> + goto out_invalid;
> node->slots[i] = NULL;
> workingset_node_shadows_dec(node);
> - BUG_ON(!mapping->nrexceptional);
> mapping->nrexceptional--;
> }
> }
> - BUG_ON(workingset_node_shadows(node));
> + if (WARN_ON_ONCE(workingset_node_shadows(node)))
> + goto out_invalid;
> inc_node_state(page_pgdat(virt_to_page(node)), WORKINGSET_NODERECLAIM);
> - if (!__radix_tree_delete_node(&mapping->page_tree, node))
> - BUG();
> + __radix_tree_delete_node(&mapping->page_tree, node);
>
> +out_invalid:
> spin_unlock(&mapping->tree_lock);
> ret = LRU_REMOVED_RETRY;
> out:
> --
> 2.10.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Jan Kara <jack@suse.cz>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH 2/6] mm: workingset: turn shadow node shrinker bugs into warnings
Date: Tue, 8 Nov 2016 10:57:25 +0100 [thread overview]
Message-ID: <20161108095725.GI32353@quack2.suse.cz> (raw)
In-Reply-To: <20161107190741.3619-3-hannes@cmpxchg.org>
On Mon 07-11-16 14:07:37, Johannes Weiner wrote:
> When the shadow page shrinker tries to reclaim a radix tree node but
> finds it in an unexpected state - it should contain no pages, and
> non-zero shadow entries - there is no need to kill the executing task
> or even the entire system. Warn about the invalid state, then leave
> that tree node be. Simply don't put it back on the shadow LRU for
> future reclaim and move on.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/workingset.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/mm/workingset.c b/mm/workingset.c
> index 617475f529f4..3cfc61d84a52 100644
> --- a/mm/workingset.c
> +++ b/mm/workingset.c
> @@ -418,23 +418,27 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
> * no pages, so we expect to be able to remove them all and
> * delete and free the empty node afterwards.
> */
> - BUG_ON(!workingset_node_shadows(node));
> - BUG_ON(workingset_node_pages(node));
> -
> + if (WARN_ON_ONCE(!workingset_node_shadows(node)))
> + goto out_invalid;
> + if (WARN_ON_ONCE(workingset_node_pages(node)))
> + goto out_invalid;
> for (i = 0; i < RADIX_TREE_MAP_SIZE; i++) {
> if (node->slots[i]) {
> - BUG_ON(!radix_tree_exceptional_entry(node->slots[i]));
> + if (WARN_ON_ONCE(!radix_tree_exceptional_entry(node->slots[i])))
> + goto out_invalid;
> + if (WARN_ON_ONCE(!mapping->nrexceptional))
> + goto out_invalid;
> node->slots[i] = NULL;
> workingset_node_shadows_dec(node);
> - BUG_ON(!mapping->nrexceptional);
> mapping->nrexceptional--;
> }
> }
> - BUG_ON(workingset_node_shadows(node));
> + if (WARN_ON_ONCE(workingset_node_shadows(node)))
> + goto out_invalid;
> inc_node_state(page_pgdat(virt_to_page(node)), WORKINGSET_NODERECLAIM);
> - if (!__radix_tree_delete_node(&mapping->page_tree, node))
> - BUG();
> + __radix_tree_delete_node(&mapping->page_tree, node);
>
> +out_invalid:
> spin_unlock(&mapping->tree_lock);
> ret = LRU_REMOVED_RETRY;
> out:
> --
> 2.10.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2016-11-08 9:57 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 19:07 [PATCH 0/6] mm: workingset: radix tree subtleties & single-page file refaults Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-07 19:07 ` [PATCH 1/6] mm: khugepaged: fix radix tree node leak in shmem collapse error path Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-08 9:53 ` Jan Kara
2016-11-08 9:53 ` Jan Kara
2016-11-08 16:12 ` Johannes Weiner
2016-11-08 16:12 ` Johannes Weiner
2016-11-09 7:41 ` Jan Kara
2016-11-09 7:41 ` Jan Kara
2016-11-11 10:59 ` Kirill A. Shutemov
2016-11-11 10:59 ` Kirill A. Shutemov
2016-11-11 12:22 ` Jan Kara
2016-11-11 12:22 ` Jan Kara
2016-11-11 16:37 ` Kirill A. Shutemov
2016-11-11 16:37 ` Kirill A. Shutemov
2016-11-14 8:07 ` Jan Kara
2016-11-14 8:07 ` Jan Kara
2016-11-14 14:29 ` Kirill A. Shutemov
2016-11-14 14:29 ` Kirill A. Shutemov
2016-11-14 15:52 ` Johannes Weiner
2016-11-14 15:52 ` Johannes Weiner
2016-11-14 16:48 ` Johannes Weiner
2016-11-14 16:48 ` Johannes Weiner
2016-11-14 19:40 ` Kirill A. Shutemov
2016-11-14 19:40 ` Kirill A. Shutemov
2016-11-15 14:00 ` Johannes Weiner
2016-11-15 14:00 ` Johannes Weiner
2016-11-07 19:07 ` [PATCH 2/6] mm: workingset: turn shadow node shrinker bugs into warnings Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-08 9:57 ` Jan Kara [this message]
2016-11-08 9:57 ` Jan Kara
2016-11-07 19:07 ` [PATCH 3/6] lib: radix-tree: native accounting of exceptional entries Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-08 10:08 ` Jan Kara
2016-11-08 10:08 ` Jan Kara
2016-11-07 19:07 ` [PATCH 4/6] lib: radix-tree: check accounting of existing slot replacement users Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-08 10:12 ` Jan Kara
2016-11-08 10:12 ` Jan Kara
2016-11-07 19:07 ` [PATCH 5/6] mm: workingset: switch shadow entry tracking to radix tree exceptional counting Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-08 10:27 ` Jan Kara
2016-11-08 10:27 ` Jan Kara
2016-11-08 19:30 ` Johannes Weiner
2016-11-08 19:30 ` Johannes Weiner
2016-11-07 19:07 ` [PATCH 6/6] mm: workingset: restore refault tracking for single-page files Johannes Weiner
2016-11-07 19:07 ` Johannes Weiner
2016-11-08 10:31 ` Jan Kara
2016-11-08 10:31 ` Jan Kara
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=20161108095725.GI32353@quack2.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@linux-foundation.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.