Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp180370ybk; Fri, 8 May 2020 23:14:27 -0700 (PDT) X-Google-Smtp-Source: APiQypKVpYMCN9foXdXbiaAaZljcb/2os20HZLwBrRK4Ttr4KIbfbjvkZdf/oDPR956Hfy2F3mlA X-Received: by 2002:a17:906:9484:: with SMTP id t4mr4834736ejx.332.1589004867438; Fri, 08 May 2020 23:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589004867; cv=none; d=google.com; s=arc-20160816; b=Pb+NHMUAIqcsGObLuz9iwKOpa31W0jtTxpuYcVC+Jo5lzYMiBBfr72UA8oYix02xJw Pr5GgKYmD0diKQmHX7cqKB7z0I/nrXfFsQi7MkMyay9CxQtnVmRNlIeRE8O4k3tpnKkr sifiWy5ai5OSlZnAuW2/pu9yiOKsxJiVIVJ5MJDABKQ+q/R7ja/DQ+uZFyk+5IsKAyP+ cO6cAwPAIVK/V/UQnLaxiEljPLuEqv3GAPi7xSJo9i+I8hTsWrVGjqrx1yeGtAoDCoq7 wWDCgUfxe0eJotUYmrikg3AP9w+Pa4Q7iW7wxXDLxn5J9hg952nftGE4T22uRA86nEZf d8CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=bies1yaP0cXleHBDO4D3SHEBlQuICnbsqP/8XeA/P1M=; b=lJa/9NS+uoRDDM8HLLL5XlwHPupd7ONfix9K1hoKn1rV9KNfvWALSyh/UI05vhU6+O G6W1RbuQWTGipW4pamneI2rk4HPZGKepNwzglFgLjzhOyLkaUDL0P4WjozydCWnPtd/V wHDa0YIbC8bircAy0YnLIKBoC2DrrYZXe5PCKOXrkThIcichSEf3EYxVVu45hpjB2tJJ mNzu4L19DpHM24NOj7NNWGqYm0qvCB5ijMbWWdxWqRxR4MAECsJblwGN3ZxM0PYKCsMY 27lEWk1L/sSk3TR49ApFKgSYO41L2wfY7KhokquXTXGUyczs5szD/PcOpJ/D6c+a6d8n I04Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oq22si2149667ejb.213.2020.05.08.23.13.48; Fri, 08 May 2020 23:14:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728815AbgEIGLj (ORCPT + 99 others); Sat, 9 May 2020 02:11:39 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:36069 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbgEIGLi (ORCPT ); Sat, 9 May 2020 02:11:38 -0400 Received: from mse-fl1.zte.com.cn (unknown [10.30.14.238]) by Forcepoint Email with ESMTPS id 2ACB3983D1DBAF8B2C8F; Sat, 9 May 2020 14:11:31 +0800 (CST) Received: from notes_smtp.zte.com.cn (notessmtp.zte.com.cn [10.30.1.239]) by mse-fl1.zte.com.cn with ESMTP id 0496AtnM050893; Sat, 9 May 2020 14:10:55 +0800 (GMT-8) (envelope-from tan.hu@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2020050914113786-3504531 ; Sat, 9 May 2020 14:11:37 +0800 From: Tan Hu To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn, wang.liang82@zte.com.cn, Tan Hu Subject: [PATCH v2] lib/flex_proportions.c: cleanup __fprop_inc_percpu_max Date: Sat, 9 May 2020 14:12:33 +0800 Message-Id: <1589004753-27554-1-git-send-email-tan.hu@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2020-05-09 14:11:37, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2020-05-09 14:11:01, Serialize complete at 2020-05-09 14:11:01 X-MAIL: mse-fl1.zte.com.cn 0496AtnM050893 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the given type has fraction smaller than max_frac/FPROP_FRAC_BASE, the code could be modified to call __fprop_inc_percpu() directly and easier to understand. After this patch, fprop_reflect_period_percpu() will be called twice, and quicky return on pl->period == p->period test, so it would not result to significant downside of performance. Thanks for Jan's guidance. Signed-off-by: Tan Hu --- lib/flex_proportions.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 7852bfff5..451543937 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -266,8 +266,7 @@ void __fprop_inc_percpu_max(struct fprop_global *p, if (numerator > (((u64)denominator) * max_frac) >> FPROP_FRAC_SHIFT) return; - } else - fprop_reflect_period_percpu(p, pl); - percpu_counter_add_batch(&pl->events, 1, PROP_BATCH); - percpu_counter_add(&p->events, 1); + } + + __fprop_inc_percpu(p, pl); } -- 2.19.1