From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756687AbcBDUqe (ORCPT ); Thu, 4 Feb 2016 15:46:34 -0500 Received: from gum.cmpxchg.org ([85.214.110.215]:56890 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbcBDUqd (ORCPT ); Thu, 4 Feb 2016 15:46:33 -0500 Date: Thu, 4 Feb 2016 15:45:40 -0500 From: Johannes Weiner To: Vladimir Davydov Cc: Andrew Morton , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] mm: memcontrol: make tree_{stat,events} fetch all stats Message-ID: <20160204204540.GD8208@cmpxchg.org> References: <57ff0330b597738127ae0f9ca331016719bea7d8.1454589800.git.vdavydov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57ff0330b597738127ae0f9ca331016719bea7d8.1454589800.git.vdavydov@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2016 at 04:03:37PM +0300, Vladimir Davydov wrote: > Currently, tree_{stat,events} helpers can only get one stat index at a > time, so when there are a lot of stats to be reported one has to call it > over and over again (see memory_stat_show). This is neither effective, > nor does it look good. Instead, let's make these helpers take a snapshot > of all available counters. > > Signed-off-by: Vladimir Davydov This looks much better, and most of the callstacks involved here are very flat, so the increased stack consumption should be alright. The only exception there is the threshold code, which can happen from the direct reclaim path and thus with a fairly deep stack already. Would it be better to leave mem_cgroup_usage() alone, open-code it, and then use tree_stat() and tree_events() only for v2 memory.stat?