Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp32275ybm; Thu, 28 May 2020 15:21:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWzEIw/zDXK3+7HiLadms+frBPQORiTP8QWAhiBrn/AwNbEkniUmmFbumok6i9Y+p85SWr X-Received: by 2002:a17:906:90c1:: with SMTP id v1mr4991526ejw.322.1590704469123; Thu, 28 May 2020 15:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590704469; cv=none; d=google.com; s=arc-20160816; b=Err3FICWwPt/Biixhoo6qdRedZ9+jvuIPVyZeAxsSw3wVaqFgqe9alagTMiNRlE6Wb m1JAOSSA7Uwd0P9tCVNaRCkRxECtXSAswll1k+8VbKcqhKOAVNXeiRyfCiWkKK4gZI92 5N1zW/lclX3vhSL4Z23ILccOlugFvr4nB4ejO3Mq9gLlRMdGSzz45cWfIGBIo9gfgOk8 JuDYWawYsHMPklBXFSeYLPabYlRVRbGIXNVReY3XYIVdre1nqaSifTmu8+UnOOCeMWYb ise1+n8k8qj5gLzAG2BWci7VJdzxUKlTQ2WwGXgyKzyH+br0EvoyNsk/EGSan2fd78jy Uodw== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=qKg4GQD93+ocMDoqhGvARqdw2NN5a+k6wEteAwkRwiM=; b=ZhAaWGUgrAp0Lr3Nn0SUh442lbrtYmx21z0yFWu99znN/KyBZX6vUQdOhLxGtMruTc sfRzZKO6vZ+F8yiY8xy/4Rtv+o59puxc/uEm+oieC5EiTu2bOmtQHhznFG1fP63c6GB9 4hCg6yUIwcBcL+qvCumJqxjSAHV+6GY3U6DpMNC6ECKEYkPSEs6TTybq5yzlOeoV1vdQ C7T4Zt5T1ZvGeSMTpJ2drzS6j0BF/ui5lod3ZTQOLEs1vqHvoBuMpgl9X4IiMppevsWm 6UcceNdAf8jccH+20S6datSXjRj9i3E2ZwkPpLEU+lNzKLkC7d+q6HyFbUTflH8Mlnqr bfNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iscaBhKa; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si4404257ejk.9.2020.05.28.15.20.44; Thu, 28 May 2020 15:21:09 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iscaBhKa; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436940AbgE1WSg (ORCPT + 99 others); Thu, 28 May 2020 18:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436938AbgE1WSd (ORCPT ); Thu, 28 May 2020 18:18:33 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 840A8C08C5C6 for ; Thu, 28 May 2020 15:18:25 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id e2so83285eje.13 for ; Thu, 28 May 2020 15:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qKg4GQD93+ocMDoqhGvARqdw2NN5a+k6wEteAwkRwiM=; b=iscaBhKaJRMBYRmL3jaCQmPS5MVKKISbeQnSfPSpwxXyMucaVpbMm7jYzrmOSWpt7E B9Wr3krAJD54Dvc2PV8TW4upnQJW2f2b9h2Y8OgM1se7+By2+dGt0vEh8TZ7HiHCgdmv hyFFjJnhP9uZFVFfdAa+u1/oyStWoFEqcJ0HejusOYyIu7U8ctVfQkDfpMuv3EZxGNeJ G8sDD7vHoZORS3ISTW62X6nXgZl6+K/kMiTko88acj764uqEBDKjTZ0AF0DOGwQpqSr7 rxMdKPAC7tN+wP0ecm++0TdKJ9G468TkeFkpX5e2G4wQ2XklVoNzgtMhZbIXc7tqFi+7 3l4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=qKg4GQD93+ocMDoqhGvARqdw2NN5a+k6wEteAwkRwiM=; b=h3j6xF1rAVWcbyKxgehToYWUVI4IBG+CznNWS6x3Qz/UCxK0ioyADV988sJhx9vugv hRr6KpbXdTjmEQzJsrHsX2Glkd+pLCNW6Io9PPjuSm3rqH2Kd1x5C5YIGn98ogjNAfNV mQoYZT2gVLLrOG5oA6D7goBGlRIg80VT8VShJTYgO7KaKsh4i6hOmPLssHs2wYHFAMxk z0O3fe8zg1v+YXKgBbDTVEhcgKfebQngqRyjJJKuZf61kxBLpVgYour/kltDw/gBHEV+ LbEgdK5dDtSqMagXHqieOUPgggqBX7P2P0Knrzatq1EoKJW0lON3MbS5Yfurd/Cac+7h 1kew== X-Gm-Message-State: AOAM5315sJRn89l85qtBAn+7iBloVyGBl4oiwHasJ3Ls/zPPKy2xNSEv ZjomkQcID2aDsLv3+2FxiPc= X-Received: by 2002:a17:906:bce6:: with SMTP id op6mr4930147ejb.337.1590704304233; Thu, 28 May 2020 15:18:24 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id r1sm5885088eja.57.2020.05.28.15.18.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 May 2020 15:18:23 -0700 (PDT) Date: Thu, 28 May 2020 22:18:22 +0000 From: Wei Yang To: Andrew Morton Cc: Wei Yang , Andy Shevchenko , Jesse Brandeburg , christian.brauner@ubuntu.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bitops: simplify get_count_order_long() Message-ID: <20200528221822.icstykoyppbeznzs@master> Reply-To: Wei Yang References: <20200524123551.9469-1-richard.weiyang@gmail.com> <20200525091458.GK1634618@smile.fi.intel.com> <20200525144312.mbw2z3ydncyasvss@master> <20200525153216.GD1634618@smile.fi.intel.com> <20200525134110.5737dd603d5fa1230e2f7ece@linux-foundation.org> <20200525215741.zd3gry4yyqqplix6@master> <20200525153146.c1337b1ca7af386ac30e5702@linux-foundation.org> <20200527224542.yx45druzqtlaxrl7@master> <20200527160508.2ef29d6904c07ca6c650638c@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200527160508.2ef29d6904c07ca6c650638c@linux-foundation.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 04:05:08PM -0700, Andrew Morton wrote: >On Wed, 27 May 2020 22:45:42 +0000 Wei Yang wrote: > >> /* a tiny module only meant to test get_count_order/long */ >> unsigned int order_comb[][2] = { >> {0x00000003, 2}, >> {0x00000004, 2}, >> {0x00001fff, 13}, >> {0x00002000, 13}, >> {0x50000000, 32}, >> {0x80000000, 32}, >> }; >> >> static int __init test_getorder_startup(void) >> { >> int i; >> >> for (i = 0; i < ARRAY_SIZE(order_comb); i++) { >> if (order_comb[i][1] != get_count_order(order_comb[i][0])) >> pr_warn("get_count_order wrong for %lx\n", >> order_comb[i][0]); >> } >> >> return 0; >> } >> >> Since I don't get a way to iterate all the possibilities, some random >> combination is chosen. Is this one looks good? > >Looks good. > >You might want to add a less-negative number as well? 0x80030000. >Something that won't turn positive if it has 1 subtracted from it. Thanks, this is a good suggestion. -- Wei Yang Help you, Help me