From: Johannes Weiner <hannes@cmpxchg.org>
To: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] radix-tree: account nodes to memcg only if explicitly requested
Date: Mon, 1 Aug 2016 11:24:09 -0400 [thread overview]
Message-ID: <20160801152409.GC7603@cmpxchg.org> (raw)
In-Reply-To: <1470057188-7864-1-git-send-email-vdavydov@virtuozzo.com>
On Mon, Aug 01, 2016 at 04:13:08PM +0300, Vladimir Davydov wrote:
> Radix trees may be used not only for storing page cache pages, so
> unconditionally accounting radix tree nodes to the current memory cgroup
> is bad: if a radix tree node is used for storing data shared among
> different cgroups we risk pinning dead memory cgroups forever. So let's
> only account radix tree nodes if it was explicitly requested by passing
> __GFP_ACCOUNT to INIT_RADIX_TREE. Currently, we only want to account
> page cache entries, so mark mapping->page_tree so.
Is this a theoretical fix, or did you actually run into problems? I
wouldn't expect any other radix tree node consumer in the kernel to
come anywhere close to the page cache, so I wonder why it matters.
> @@ -351,6 +351,12 @@ static int __radix_tree_preload(gfp_t gfp_mask, int nr)
> struct radix_tree_node *node;
> int ret = -ENOMEM;
>
> + /*
> + * Nodes preloaded by one cgroup can be be used by another cgroup, so
> + * they should never be accounted to any particular memory cgroup.
> + */
> + gfp_mask &= ~__GFP_ACCOUNT;
But *all* page cache radix tree nodes are allocated from inside the
preload code, since the tree insertions need mapping->tree_lock. So
this would effectively disable accounting of the biggest radix tree
consumer in the kernel, no?
--
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: Johannes Weiner <hannes@cmpxchg.org>
To: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] radix-tree: account nodes to memcg only if explicitly requested
Date: Mon, 1 Aug 2016 11:24:09 -0400 [thread overview]
Message-ID: <20160801152409.GC7603@cmpxchg.org> (raw)
In-Reply-To: <1470057188-7864-1-git-send-email-vdavydov@virtuozzo.com>
On Mon, Aug 01, 2016 at 04:13:08PM +0300, Vladimir Davydov wrote:
> Radix trees may be used not only for storing page cache pages, so
> unconditionally accounting radix tree nodes to the current memory cgroup
> is bad: if a radix tree node is used for storing data shared among
> different cgroups we risk pinning dead memory cgroups forever. So let's
> only account radix tree nodes if it was explicitly requested by passing
> __GFP_ACCOUNT to INIT_RADIX_TREE. Currently, we only want to account
> page cache entries, so mark mapping->page_tree so.
Is this a theoretical fix, or did you actually run into problems? I
wouldn't expect any other radix tree node consumer in the kernel to
come anywhere close to the page cache, so I wonder why it matters.
> @@ -351,6 +351,12 @@ static int __radix_tree_preload(gfp_t gfp_mask, int nr)
> struct radix_tree_node *node;
> int ret = -ENOMEM;
>
> + /*
> + * Nodes preloaded by one cgroup can be be used by another cgroup, so
> + * they should never be accounted to any particular memory cgroup.
> + */
> + gfp_mask &= ~__GFP_ACCOUNT;
But *all* page cache radix tree nodes are allocated from inside the
preload code, since the tree insertions need mapping->tree_lock. So
this would effectively disable accounting of the biggest radix tree
consumer in the kernel, no?
next prev parent reply other threads:[~2016-08-01 15:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-01 13:13 [PATCH] radix-tree: account nodes to memcg only if explicitly requested Vladimir Davydov
2016-08-01 13:13 ` Vladimir Davydov
2016-08-01 15:24 ` Johannes Weiner [this message]
2016-08-01 15:24 ` Johannes Weiner
2016-08-01 16:06 ` Vladimir Davydov
2016-08-01 16:06 ` Vladimir Davydov
2016-08-01 17:14 ` Johannes Weiner
2016-08-01 17:14 ` Johannes Weiner
2016-08-02 11:51 ` Michal Hocko
2016-08-02 11:51 ` Michal Hocko
2016-08-02 12:42 ` Vladimir Davydov
2016-08-02 12:42 ` Vladimir Davydov
2016-08-02 12:46 ` Michal Hocko
2016-08-02 12:46 ` Michal Hocko
2016-08-02 18:51 ` Andrew Morton
2016-08-02 18:51 ` Andrew Morton
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=20160801152409.GC7603@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vdavydov@virtuozzo.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 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.