Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760064AbcCECwE (ORCPT ); Fri, 4 Mar 2016 21:52:04 -0500 Received: from g1t6214.austin.hp.com ([15.73.96.122]:40896 "EHLO g1t6214.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759462AbcCECwC (ORCPT ); Fri, 4 Mar 2016 21:52:02 -0500 From: Waiman Long To: Tejun Heo , Christoph Lameter , Dave Chinner Cc: xfs@oss.sgi.com, linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Scott J Norton , Douglas Hatch , Waiman Long Subject: [RFC PATCH 0/2] percpu_counter: Enable switching to global counter Date: Fri, 4 Mar 2016 21:51:37 -0500 Message-Id: <1457146299-1601-1-git-send-email-Waiman.Long@hpe.com> X-Mailer: git-send-email 1.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1236 Lines: 29 This patchset allows the degeneration of per-cpu counters back to global counters when: 1) The number of CPUs in the system is large, hence a high cost for calling percpu_counter_sum(). 2) The initial count value is small so that it has a high chance of excessive percpu_counter_sum() calls. When the above 2 conditions are true, this patchset allows the user of per-cpu counters to selectively degenerate them into global counters with lock. This is done by calling the new percpu_counter_set_limit() API after percpu_counter_set(). Without this call, there is no change in the behavior of the per-cpu counters. Patch 1 implements the new percpu_counter_set_limit() API. Patch 2 modifies XFS to call the new API for the m_ifree and m_fdblocks per-cpu counters. Waiman Long (2): percpu_counter: Allow falling back to global counter on large system xfs: Allow degeneration of m_fdblocks/m_ifree to global counters fs/xfs/xfs_mount.c | 1 - fs/xfs/xfs_mount.h | 5 +++ fs/xfs/xfs_super.c | 6 +++ include/linux/percpu_counter.h | 10 +++++ lib/percpu_counter.c | 72 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 92 insertions(+), 2 deletions(-)