From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754106AbcHAPYX (ORCPT ); Mon, 1 Aug 2016 11:24:23 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:55650 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754078AbcHAPYQ (ORCPT ); Mon, 1 Aug 2016 11:24:16 -0400 Date: Mon, 1 Aug 2016 11:24:09 -0400 From: Johannes Weiner To: Vladimir Davydov Cc: Andrew Morton , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] radix-tree: account nodes to memcg only if explicitly requested Message-ID: <20160801152409.GC7603@cmpxchg.org> References: <1470057188-7864-1-git-send-email-vdavydov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1470057188-7864-1-git-send-email-vdavydov@virtuozzo.com> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?