Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2382218ybk; Mon, 11 May 2020 20:34:37 -0700 (PDT) X-Google-Smtp-Source: APiQypJgB6T+7HqBUUuYRmn6t55AQX48Jnv9eMc0BJhqAiFefm7ttrdwtyEndIqfp3MMbWS/8xKS X-Received: by 2002:a17:906:7282:: with SMTP id b2mr16453288ejl.161.1589254477079; Mon, 11 May 2020 20:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589254477; cv=none; d=google.com; s=arc-20160816; b=l6k7vs40dErFdHaQEy+J8VfzAxPGhc93ZRHLAs4NFRoItc295dbKXd5oUK0GgBE09z DJnPZJ3uE6wkB5dkBrL3O0D4LSqIluaocmwVkYO8IWZ970/YwYlCkXFhy75hVH9z8o33 tAU6RlpfRUPau7ve3h0wkBkGtLBvIuKaZHCGPX52eiFf3hftCdsUT3ITSPafm6r233Tl Rd8MemKQTNyyivduNnqdJ889oO9RnCUM/fJr22Km1ZM2RtSaUPf9ZpAnRSI8cpFUzacp XAkMDX9H4ii9ebfgktMRsoBnXyn/El92jXiZOmirIbc8wr5noxfaZZ/I7kQixz1/IGoS hq+g== 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=m9DcTctaXltB7kprYBVIurSH02K2JrjmZafnF5H6rks=; b=MWSzq1RwS5bbIOf25r51NtcP1NV2YNFV/+9sCcz6SMvEIEsZ37sRPkmlSkyAn/4o8U zJ2ROVytLBKF5RTpS7JSD8vJggIaDBdykK8nnqCPK7Iqv29La1KmjLNVVI6EUlkeBDbx +PuT5pA10iQPjZN3wOjQT8f1kM+SUtQvpPWMM1vKYSl+fvRmdBMsij+Iu7Ec104WoXHw 8SYFoI9AShnBr5U6rmV2zvQiisBm5oaim28We1SBE7JgOWh5uGEW4RwWj5jmU8jGwCxm oD40RWYGveaTJlzpRMiDm0v528CrVZuvgBiSmYGAB9CUwZwGcIES6nk7TVXbm3hVcY9v jMaw== 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 j2si3683073ejs.531.2020.05.11.20.34.14; Mon, 11 May 2020 20:34:37 -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 S1728828AbgELDaq (ORCPT + 99 others); Mon, 11 May 2020 23:30:46 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:61864 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728753AbgELDao (ORCPT ); Mon, 11 May 2020 23:30:44 -0400 Received: from mse-fl2.zte.com.cn (unknown [10.30.14.239]) by Forcepoint Email with ESMTPS id 81AE933B73D18C427C12; Tue, 12 May 2020 11:30:14 +0800 (CST) Received: from notes_smtp.zte.com.cn (notes_smtp.zte.com.cn [10.30.1.239]) by mse-fl2.zte.com.cn with ESMTP id 04C3Pnvg019360; Tue, 12 May 2020 11:25:49 +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 2020051211260006-3533846 ; Tue, 12 May 2020 11:26:00 +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 v3] lib/flex_proportions.c: cleanup __fprop_inc_percpu_max Date: Tue, 12 May 2020 11:27:34 +0800 Message-Id: <1589254054-48833-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-12 11:26:00, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2020-05-12 11:25:51, Serialize complete at 2020-05-12 11:25:51 X-MAIL: mse-fl2.zte.com.cn 04C3Pnvg019360 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 Reviewed-by: Jan Kara --- 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