Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1789247ybk; Mon, 11 May 2020 04:25:24 -0700 (PDT) X-Google-Smtp-Source: APiQypJzHhZl9i4i8pzVzX0ei5/1wmHlRWHLfbJnwNpi54REexOxf4o/LOk8FqcljGJ3TULqVhx8 X-Received: by 2002:a17:906:1443:: with SMTP id q3mr13186633ejc.325.1589196324391; Mon, 11 May 2020 04:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589196324; cv=none; d=google.com; s=arc-20160816; b=iSFZWHySBO05GAm2PCuU7b15YmmXY487eHjjXI8o7RkyfEpLLtkk1dtvm0IRpJ/Amg s/V6pI3aLoqph5sE0QoP09jxBWqPq9Vegc5M1HgDG5fIGvBxpo0mYcqEM0cQ0rafPMvA X+6wwab8Q9oHlffSBxb7qGmCtTnvzLSrbR9QfwHsfu2vcy5RelDHmRua5npnid8ysOvJ dssWJNiLHpAy9VxgJC7GuWkLqhH3NpuAJiUe2dvb9mzzKJtF20mNq4ShXKlU3MOcwBl0 V7QR5qQskTReWUgxrECRkrZw0EkzZXY0AjP29l6ZRiRjsBKX4jxIgUC/bmtUAigT+4Zx BEug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vsld+IBCPqnV9TswdvUnm5VJICQ3SH6DmBZxY0qMWXY=; b=TyebgO+X1TGlgBcf6js9Erf/Y+DOnBkeq3JUwI4JxDVEq02xno9JstBLdPeUM+tHit bgpPp3PVVECZiNHpLgx/cXaoh5tOLNvOWGl8UvcDYP8NDXYJbeUIec3rvPSB7QolPLT6 YkDDjE7VMrRwUlh4xHv/sW64IuU12e4b+HuJM7jgGH9M8PzL+XTKWzVZ6o41T+lK7Osg IGOmo6Jn1zMRqda6BHX/f6yHnIFNuZOh22eADVzphAXXPQSJx2n8GSapntrFGKlMiVvh r/T6xMZ+FUTmjrKF0wi7z09Qcj8imPZ6cA9YUdwAmO8L28a21bjqt55cRmlZ0uPNDMh1 2nhA== 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 n8si5924946edb.372.2020.05.11.04.25.01; Mon, 11 May 2020 04:25:24 -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 S1729566AbgEKLXm (ORCPT + 99 others); Mon, 11 May 2020 07:23:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:50420 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728531AbgEKLXm (ORCPT ); Mon, 11 May 2020 07:23:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 24EE4AD0E; Mon, 11 May 2020 11:23:44 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id ED7E61E04D2; Mon, 11 May 2020 13:23:40 +0200 (CEST) Date: Mon, 11 May 2020 13:23:40 +0200 From: Jan Kara To: Tan Hu Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, jack@suse.cz, xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn, wang.liang82@zte.com.cn Subject: Re: [PATCH v2] lib/flex_proportions.c: cleanup __fprop_inc_percpu_max Message-ID: <20200511112340.GB1864@quack2.suse.cz> References: <1589004753-27554-1-git-send-email-tan.hu@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1589004753-27554-1-git-send-email-tan.hu@zte.com.cn> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 09-05-20 14:12:33, Tan Hu wrote: > 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 Thanks for the patch. It looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR