Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1666383ybs; Tue, 26 May 2020 00:07:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9ynp56ExonK/HxlY6HgIUffOw6qZqbbL3jzn68bV0IbtBgp7w453uIRghw0si6awbgAyY X-Received: by 2002:a17:906:13ca:: with SMTP id g10mr22154407ejc.493.1590476864119; Tue, 26 May 2020 00:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590476864; cv=none; d=google.com; s=arc-20160816; b=Jcgyfrvc0yhCTX29qcO0RkS50/z7CJkVkKZ3jP3Xy9RiMwf9G3ILMRd3rCQIPEERuf hQhqIl6hzOjxnUtClgkF333hHX9gCZOufB4CSdk8fLVAJ/crvNDO7NJDN7fk/+pbI5vk J4VxehyujJQGqA5GwtqnJU/XIGC3zgRw5gjqij0Wnjn2lz3/xpBM1ga+ftJ8tOIUD0Ae fe4zYKnrNeLt3iTtY8NiOQhzE1G60HNkepq5V9bM8RPSaMnA/aDoqNcK2+Ogk/EVuxPS vh98ZPz2r9Va0rAtCpktWMsH1lQRTepiigJPbzvCFnBXEdEg4XrxSh/U2m3DR1AnEuS0 Tt5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=smomAgT12i8aZvfjyKHT28IFzlvcLnP1aLkhp+lczzA=; b=U9TqHeVkYttLfTJr3NiBgsJIVVWzDKdTrYZKdjdvKsnz0Bla8LiO50T46vF1G7poUy y2qw802PliG44bMmZyY8ZEgM71bAkkRah/g9V+41GjEpxjU/4U8sGxfmVT07DmrOEZPT DfDF2te+iYB6rsyp5rUKR1s01rZ5it7GWQei6057i0sGGYqFqxvaGlc9ZCEhTftkT2Ov k+mM/IS6F372ib5/JrxKCQAhusCzBjrcN0pCL67SwR3cqL7bc8s8bsRdP7amKvGbEqv8 Qbrb/ojAJ+hWkCPTw7LKLAUwv8CZ2FI496GwTQu8gb+LyQ/UJjhmyKVuiTFl01uCvlyL M99Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si11074631eje.295.2020.05.26.00.07.21; Tue, 26 May 2020 00:07:44 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731590AbgEZHE4 (ORCPT + 99 others); Tue, 26 May 2020 03:04:56 -0400 Received: from mga04.intel.com ([192.55.52.120]:8968 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730279AbgEZHE4 (ORCPT ); Tue, 26 May 2020 03:04:56 -0400 IronPort-SDR: UnhNrubU9g9QDXY28c6E4K/dWn5RhLOEgT3u8YdBJeLYlucF0J9IWc+hBkbPe+L0TT30otoCm7 am3oddrcINzQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2020 00:04:56 -0700 IronPort-SDR: B611kmOgwwE11wl4NpbiHCfzPGJ3u5qywipKQwB48fOpRx4YlqewqbcMG9PQFqHVWiAEOGXwaG zjDbvYZiCyNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,436,1583222400"; d="scan'208";a="284335349" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002.jf.intel.com with ESMTP; 26 May 2020 00:04:54 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jdTdx-008wJQ-Su; Tue, 26 May 2020 10:04:57 +0300 Date: Tue, 26 May 2020 10:04:57 +0300 From: Andy Shevchenko To: Wei Yang Cc: akpm@linux-foundation.org, christian.brauner@ubuntu.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bitops: use the same mechanism for get_count_order[_long] Message-ID: <20200526070457.GI1634618@smile.fi.intel.com> References: <20200525215958.21653-1-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200525215958.21653-1-richard.weiyang@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 25, 2020 at 09:59:58PM +0000, Wei Yang wrote: > These two functions share the same logic. So, same comment. Please, add test first, make sure it works on current kernel, then after your patch applied, and send it as a series, thanks! P.S. W/o test code looks good, but based on my experience I'm very suspicious about "small" changes that may lead to big issues. Hope you understand my point. > Signed-off-by: Wei Yang > --- > include/linux/bitops.h | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index 5b5609e81a84..80703ef27aee 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -188,12 +188,10 @@ static inline unsigned fls_long(unsigned long l) > > static inline int get_count_order(unsigned int count) > { > - int order; > + if (count == 0) > + return -1; > > - order = fls(count) - 1; > - if (count & (count - 1)) > - order++; > - return order; > + return fls(--count); > } > > /** > -- > 2.23.0 > -- With Best Regards, Andy Shevchenko