Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp499145rwb; Thu, 18 Aug 2022 07:26:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5BhGuO0h+5fDaoqHaXU9cX0yT2FAoV3dTfCsmHsBUveKDTSEZ0mQxaQE72oe/UeddGQpZ9 X-Received: by 2002:a17:906:5d13:b0:733:10e:b957 with SMTP id g19-20020a1709065d1300b00733010eb957mr2053405ejt.452.1660832796349; Thu, 18 Aug 2022 07:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660832796; cv=none; d=google.com; s=arc-20160816; b=Pa43kqbaNJJQVTP4kZIbiMd0KdeeJ5STzU4raXXEMf2Vkm+HHw1rU/3kWcFJVPBu5A Q9YHHGm8fG7jRPb5W4HM67IegE+lNfEO58g9I8zZR1+dbJu7DIw0d0nYxmpSXGs8Yy9/ F0f1oznv6Kk5FitNkzhxU6LEf8HfjC8I+o4cjmLkH5OQsdhxPUKFpn9lsWUlcTOEZVNq WCdHQURx2xq654yxfiYG8qL1f5OQEjfXgBt6p9zIh8d0y8gq0qZY8HLakv4AmL7LYp/W 4+7AidvGoQBq2KIhu3rLinZ5uRGzuKd/ZLhuooYaL0QZXaaYbKXuSKUCmvhJEp7zcNmX Iu2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=fYEf8Zbj+SEUfdI1iuXS3DOh7e+BOWFGEUBiTwT72lA=; b=RkWVFyA85KcS9PeSsMx4m5FGSVsmU5oWPpL5vVVwpwUY4PiW/FbfEz/ro0+HOXs9MY lnURArHEr8OLDd7XVLgsNC7XDfBEwEvWd2cAKJazDxkt7QCx+o/DkMqaAJjibWac/Krz iBNqAW1XPvx/r8ZBEvwzIDAEfheZrsb3xi6ids36tm7gF0K3s+Valn3gt57wo9IH5bAb FhzkBFrr9p34iP/vSEGbJ4WoiR8qe9Y1l0ZUS/fesl8SncSwJPndWwIOZ/uGLefX8/Ag 2pa40wg7ziiCWw34aNtD5CBvDs8LkRKO2tQDEHjZDpd/aAOI/OdDIssCj6AD9a/6efNl 93vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb9-20020a170907160900b0073081d6727fsi1362002ejc.726.2022.08.18.07.26.09; Thu, 18 Aug 2022 07:26:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245144AbiHROIm (ORCPT + 99 others); Thu, 18 Aug 2022 10:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245652AbiHROIU (ORCPT ); Thu, 18 Aug 2022 10:08:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA433F31; Thu, 18 Aug 2022 07:08:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9790EB821B0; Thu, 18 Aug 2022 14:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3534C433C1; Thu, 18 Aug 2022 14:08:09 +0000 (UTC) Date: Thu, 18 Aug 2022 10:08:20 -0400 From: Steven Rostedt To: Valentin Schneider Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Mel Gorman , Greg Kroah-Hartman , Barry Song , Heiko Carstens , Tony Luck , Jonathan Cameron , Gal Pressman , Tariq Toukan Subject: Re: [PATCH v2 1/5] bitops: Introduce find_next_andnot_bit() Message-ID: <20220818100820.3b45808b@gandalf.local.home> In-Reply-To: <20220817175812.671843-2-vschneid@redhat.com> References: <20220817175812.671843-1-vschneid@redhat.com> <20220817175812.671843-2-vschneid@redhat.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Aug 2022 18:58:08 +0100 Valentin Schneider wrote: > +#ifndef find_next_andnot_bit > +/** > + * find_next_andnot_bit - find the next set bit in one memory region > + * but not in the other > + * @addr1: The first address to base the search on > + * @addr2: The second address to base the search on > + * @size: The bitmap size in bits > + * @offset: The bitnumber to start searching at > + * > + * Returns the bit number for the next set bit > + * If no bits are set, returns @size. Can we make the above documentation more descriptive. Because I read this three times, and I still have no idea what it does. The tag line sounds like the nursery song "One of these things is not like the others". -- Steve > + */ > +static inline > +unsigned long find_next_andnot_bit(const unsigned long *addr1, > + const unsigned long *addr2, unsigned long size, > + unsigned long offset) > +{ > + if (small_const_nbits(size)) { > + unsigned long val; > + > + if (unlikely(offset >= size)) > + return size; > + > + val = *addr1 & ~*addr2 & GENMASK(size - 1, offset); > + return val ? __ffs(val) : size; > + } > + > + return _find_next_bit(addr1, addr2, size, offset, 0UL, ~0UL, 0); > } > #endif