From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756111AbbGPPzJ (ORCPT ); Thu, 16 Jul 2015 11:55:09 -0400 Received: from mail-yk0-f195.google.com ([209.85.160.195]:33673 "EHLO mail-yk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755707AbbGPPzG (ORCPT ); Thu, 16 Jul 2015 11:55:06 -0400 Date: Thu, 16 Jul 2015 11:55:02 -0400 From: Tejun Heo To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, vgoyal@redhat.com, avanzini.arianna@gmail.com Subject: [PATCH 11/10] blkcg: reduce stack usage of blkg_rwstat_recursive_sum() Message-ID: <20150716155502.GW15934@mtj.duckdns.org> References: <1436724043-12986-1-git-send-email-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436724043-12986-1-git-send-email-tj@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>From 8c6417cb56c71efd47d28d15bc117567f3171c93 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 16 Jul 2015 11:50:49 -0400 The recent percpu conversion of blkg_rwstat triggered the following warning in certain configurations. block/blk-cgroup.c:654:1: warning: the frame size of 1360 bytes is larger than 1024 bytes This is because blkg_rwstat now contains four percpu_counter which can be pretty big depending on debug options although it shouldn't be a problem in production configs. This patch removes one of the two local blkg_rwstat variables used by blkg_rwstat_recursive_sum() to reduce stack usage. Signed-off-by: Tejun Heo Cc: Vivek Goyal Reported-by: kbuild test robot Link: http://article.gmane.org/gmane.linux.kernel.cgroups/13835 --- Hello, One extra patch to deal with stack usage bloat under debug configs which came with percpu_counter conversion. git branch updated accordingly. Thanks. block/blk-cgroup.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 2469a65..0d5b8b8 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -744,7 +744,7 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, rcu_read_lock(); blkg_for_each_descendant_pre(pos_blkg, pos_css, blkg) { - struct blkg_rwstat *rwstat, tmp; + struct blkg_rwstat *rwstat; if (!pos_blkg->online) continue; @@ -754,12 +754,10 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, else rwstat = (void *)pos_blkg + off; - tmp = blkg_rwstat_read(rwstat); - for (i = 0; i < BLKG_RWSTAT_NR; i++) - atomic64_add(atomic64_read(&tmp.aux_cnt[i]) + - atomic64_read(&rwstat->aux_cnt[i]), - &sum.aux_cnt[i]); + atomic64_add(atomic64_read(&rwstat->aux_cnt[i]) + + percpu_counter_sum_positive(&rwstat->cpu_cnt[i]), + &sum.aux_cnt[i]); } rcu_read_unlock(); -- 2.4.3