Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1453278 > unrolled thread
| Started by | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| First post | 2016-08-01 17:30 +0200 |
| Last post | 2016-08-01 19:20 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] radix-tree: account nodes to memcg only if explicitly requested Johannes Weiner <hannes@cmpxchg.org> - 2016-08-01 17:30 +0200
Re: [PATCH] radix-tree: account nodes to memcg only if explicitly requested Johannes Weiner <hannes@cmpxchg.org> - 2016-08-01 19:20 +0200
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2016-08-01 17:30 +0200 |
| Subject | Re: [PATCH] radix-tree: account nodes to memcg only if explicitly requested |
| Message-ID | <s1nke-834-17@gated-at.bofh.it> |
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?
[toc] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2016-08-01 19:20 +0200 |
| Message-ID | <s1p2F-MQ-13@gated-at.bofh.it> |
| In reply to | #1453278 |
On Mon, Aug 01, 2016 at 07:06:05PM +0300, Vladimir Davydov wrote:
> On Mon, Aug 01, 2016 at 11:24:09AM -0400, Johannes Weiner wrote:
> > On Mon, Aug 01, 2016 at 04:13:08PM +0300, Vladimir Davydov wrote:
> > > @@ -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?
>
> No, that's not how accounting of radix tree nodes works. We never
> account preloaded nodes, because this could result in a node accounted
> to one cgroup used by an unrelated cgroup. Instead we always try to
> kmalloc a node on insertion falling back on preloads only if kmalloc
> fails - see commit 58e698af4c634 ("radix-tree: account radix_tree_node
> to memory cgroup").
You are right, I forgot we are doing this. The patch makes sense then.
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web