From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90BD038CFE8 for ; Mon, 8 Jun 2026 19:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780946687; cv=none; b=WJgRw9XQbiiMv9ugM7Tb5Sd5zQFs9qWVTCb4EfHPdOGqIWf4GvTffwS4O6PcCpgWx7LvZ1ho7TvkE3JvY2twUPQrKEOCZ6rT2+95omYS3EVU8su5KY+DTiX9Peu4sP2S74o3yRJWm2U5rgxIWWQ7HHhCJzxmgGD0uqoDqKqMDHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780946687; c=relaxed/simple; bh=28AwNh/EfoXt4DOCQRSzcdh4QI5HYxoPn3aDbRGQWM8=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=D9V8un1YheJkCskGmkAlsF+v3rAKfQDJn7Ga1KbiD3FeKRuVAMTVz8kl+gsDmPUB+Avvb3au6nCQKb3N5eeNVxfFCkjQgfYWyknUBkVE02UTdJyoh6ec7aWy8b1AyTMUlbXf1en+Q5Z/lsDiiRqCmyLNtML7gFxbsBbbTJ+g7/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PuOXs3Tq; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PuOXs3Tq" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-7ea6923cc94so47919407b3.3 for ; Mon, 08 Jun 2026 12:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780946684; x=1781551484; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=jCiAsp0PrhthgEoPXLbgJ/wRR4S9dHi9kSotTklM9yo=; b=PuOXs3TqHj6BsM4JSvylD27YpGAOdPHz7hqcUZjzR2EDXjsY483RMrRx+ewXScNrY3 DtAvXzw6nO248oKsi3S0WZV9n6HA3MlRwe8SZpheu6CSniP9zmD9sIvEckNOXWAgiVwH xz6VC+DFl65sxm6ajwgf3jnShvpSRmzTn+t/FIJJBEV7DWnWN+4VYRTCYA+iYbYq7g1n Yh2WC3hl9BVXxs/yMRl1yA82JAAxuUYn4IccmsrC9zZcNJjd135/eE9IjyyXwosMC2bj ka2VHRsEWuzAnYrp0wGMR9Zbs3tjeOaLoE2AhSexnO0H6j3gROTvuQvCi7crn17ZbiuG xbxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780946684; x=1781551484; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jCiAsp0PrhthgEoPXLbgJ/wRR4S9dHi9kSotTklM9yo=; b=BJOtwE9poGXccT3VzfIrklQa5rVBH44oaf7hhlCydywpd+CGs3uUkh48vtg+346oJE v3XK7SHPce/atJLiVjCNC999Ig0iCC+UbKIHHU+KuahzvzO3wad8pGx4h1LdDuVoG0Sg vc+o3eA9FTie2i46RmUm4aL9vj3RzPOvJfqJSKC1jxytNVfXoM/AwakYOZG0Hf+FFj2T J7gbD8p2ISuc0jAvhFFLn1+z2nF7ZkhygnxrKtsoK5GAQ8i6l1eeWCw91ci2fUChe3FT 8KCMF2f46vatTm2a7HE+RZ89KKXlteuqsxdxaZYPAzeRFOpOi3zBom8PE7ntLa5UEDzP qEnw== X-Forwarded-Encrypted: i=1; AFNElJ+eoB1XT4n+3FD1Kfs3YWHGLzf5D/YkmnNhWf8Aq4v84BVycBkavN0Xj6NW7C88+x1vWU989ZQnt/erjdU=@vger.kernel.org X-Gm-Message-State: AOJu0Ywf2wQU4f7rsox0tHXyi6iu1cybADUeHXNCRHZP9OgvwlTFQb8/ KPQI0J5F2cwBh4dxZmdxFCtdzjqZt1Pt3k+iZEuTwxsVdGNzP4W8HKxD X-Gm-Gg: Acq92OGqwthWONIXIIUzr8nd6LfK0dy3IqtJL3QB9F9RDDwtxFwOZoboX51kj6Nhi8E tCMKJA1ud5wMUlD7vUQTjJ84mwhFLgu8donOl8txt/E7CJCY1J37tFVWTueMOKY/qNSAAfW0wJz buvX2TQW00TOkqCBJLlK7DwEunQG5wbjKmhldmxswnKDbMPlWDaf4PUoSOsEhoPhrNs89h46JPy XU+xQ0TCMrZ5uR3R7if0Bs700U8uxo3egucncN9o5bUo6KgbQyfc6GPDx5XxjtHzZMZ5T91IfYc 2A0YJCBoyt3kfkECJygGKatkK2aGX9d36RAYVWYzPWMMwS6Au0bFArYK7LHKIdFs0Dt6gh6Qssi YRpF5wgarFJWscXISZ+9NWl8IFdgBDyMPrkJjAzNZfR5hPfwDOBNcOUrQeNfrqj60VHY7lAD4qg 4bmAcYbsrDZgtQWFui6CFud4r16WKNYHlkzQHZ6NA= X-Received: by 2002:a05:690c:e344:b0:7dd:63c7:3998 with SMTP id 00721157ae682-7ed0a4f27d0mr164829037b3.5.1780946684630; Mon, 08 Jun 2026 12:24:44 -0700 (PDT) Received: from localhost ([50.221.107.122]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7ea2409b2afsm88231187b3.45.2026.06.08.12.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 12:24:44 -0700 (PDT) From: Yury Norov X-Google-Original-From: Yury Norov Date: Mon, 8 Jun 2026 15:24:43 -0400 To: Yury Norov Cc: Yi Sun , mnazarewicz@gmail.com, akpm@linux-foundation.org, mina86@mina86.com, akinobu.mita@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] lib/bitmap: add tests for bitmap_find_next_zero_area_off() Message-ID: References: <20260601094234.103863-1-yi.sun@unisoc.com> <20260601094234.103863-3-yi.sun@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: (Sorry, hit 'send' prematurely with a fat finger) On Mon, Jun 08, 2026 at 03:14:22PM -0400, Yury Norov wrote: > On Mon, Jun 01, 2026 at 05:42:34PM +0800, Yi Sun wrote: > > Add functional and performance tests > > for bitmap_find_next_zero_area_off(). > > > > Signed-off-by: Yi Sun > > --- > > lib/find_bit_benchmark.c | 17 +++++++++++++++++ > > lib/test_bitmap.c | 28 ++++++++++++++++++++++++++++ > > 2 files changed, 45 insertions(+) > > > > diff --git a/lib/find_bit_benchmark.c b/lib/find_bit_benchmark.c > > index 00d9dc61cd46..37fe76ad322e 100644 > > --- a/lib/find_bit_benchmark.c > > +++ b/lib/find_bit_benchmark.c > > @@ -149,6 +149,21 @@ static int __init test_find_next_and_bit(const void *bitmap, > > return 0; > > } > > > > +static int __init > > +test_bitmap_find_next_zero_area_off(unsigned long *bitmap, unsigned long len) > > +{ > > + unsigned long i, cnt; > > + ktime_t time; > > + > > + time = ktime_get(); > > + for (cnt = i = 0; i < BITMAP_LEN; cnt++) > > + i = bitmap_find_next_zero_area_off(bitmap, BITMAP_LEN, i, 8, 0, 0) + 1; > > + time = ktime_get() - time; > > + pr_err("bitmap_find_next_zero_area_off: %18llu ns, %6ld iterations\n", time, cnt); > > + > > + return 0; > > +} I asked you at least 3 times to print the exact test output in the commit message. If you didn't ignore it, you'd see something like: [ 0.230280] Start testing find_bit() with random-filled bitmap [ 0.231438] bitmap_find_next_zero_area_off: 352393 ns, 1235 iterations [ 0.232771] find_next_bit: 586225 ns, 163838 iterations [ 0.234022] find_next_zero_bit: 631854 ns, 163843 iterations [ 0.235154] find_last_bit: 489426 ns, 163839 iterations [ 0.238080] find_nth_bit: 2283610 ns, 16471 iterations [ 0.239545] find_first_bit: 844551 ns, 16472 iterations [ 0.248981] find_first_and_bit: 8840955 ns, 41232 iterations [ 0.250030] find_next_and_bit: 334729 ns, 81913 iterations [ 0.250728] [ 0.250728] Start testing find_bit() with sparse bitmap [ 0.253094] bitmap_find_next_zero_area_off: 1658964 ns, 322485 iterations [ 0.253851] find_next_bit: 8053 ns, 655 iterations [ 0.255664] find_next_zero_bit: 1247380 ns, 327026 iterations [ 0.256292] find_last_bit: 7444 ns, 655 iterations [ 0.257756] find_nth_bit: 865494 ns, 654 iterations [ 0.258720] find_first_bit: 284844 ns, 655 iterations [ 0.259347] find_first_and_bit: 1824 ns, 1 iterations [ 0.259992] find_next_and_bit: 1763 ns, 1 iterations And it clearly breaks the test format. Please, when it comes to v5, double check that you have all reviewers requests addressed. > > + > > static int __init find_bit_test(void) > > { > > unsigned long nbits = BITMAP_LEN / SPARSE; > > @@ -158,6 +173,7 @@ static int __init find_bit_test(void) > > get_random_bytes(bitmap, sizeof(bitmap)); > > get_random_bytes(bitmap2, sizeof(bitmap2)); > > > > + test_bitmap_find_next_zero_area_off(bitmap, BITMAP_LEN); > > test_find_next_bit(bitmap, BITMAP_LEN); > > test_find_next_zero_bit(bitmap, BITMAP_LEN); > > test_find_last_bit(bitmap, BITMAP_LEN); > > @@ -181,6 +197,7 @@ static int __init find_bit_test(void) > > __set_bit(get_random_u32_below(BITMAP_LEN), bitmap2); > > } > > > > + test_bitmap_find_next_zero_area_off(bitmap, BITMAP_LEN); > > test_find_next_bit(bitmap, BITMAP_LEN); > > test_find_next_zero_bit(bitmap, BITMAP_LEN); > > test_find_last_bit(bitmap, BITMAP_LEN); > > diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c > > index 69813c10e6c0..fad2b19760c2 100644 > > --- a/lib/test_bitmap.c > > +++ b/lib/test_bitmap.c > > @@ -234,6 +234,34 @@ static void __init test_find_nth_bit(void) > > } > > } > > > > +static void __init > > +test_bitmap_find_next_zero_area_off(void) > > warning: ‘test_bitmap_find_next_zero_area_off’ defined but not used [-Wunused-function] > 238 | test_bitmap_find_next_zero_area_off(void) > > > +{ > > + int bmap_len = 64 * 3; > > + DECLARE_BITMAP(bmap, bmap_len); > > I believe, everyone can realize that 64*3 == 192, and we don't need a > variable for it. > > > + bitmap_set(bmap, 0, bmap_len); > > + > > + bitmap_clear(bmap, 0, 8); > > + __clear_bit(50, bmap); > > + bitmap_clear(bmap, 60, 10); > > + __clear_bit(80, bmap); > > + bitmap_clear(bmap, 100, 10); > > + __clear_bit(120, bmap); > > + bitmap_clear(bmap, 160, 32); > > Can you also test a 'dirty' region: > > bitmap_clear(60, 18); > __set_bit(69); > // find nothing > bitmap_find_next_zero_area_off(bmap, bmap_len, 0, 10, 0, 0)); > > > + > > + expect_eq_uint(0, > > + bitmap_find_next_zero_area_off(bmap, bmap_len, 0, 8, 0, 0)); > > + expect_eq_uint(60, > > + bitmap_find_next_zero_area_off(bmap, bmap_len, 1, 8, 0, 0)); > > + expect_eq_uint(60, > > + bitmap_find_next_zero_area_off(bmap, bmap_len, 0, 10, 0, 0)); > > + expect_eq_uint(160, > > + bitmap_find_next_zero_area_off(bmap, bmap_len, 0, 32, 0, 0)); > > + expect_eq_uint(1, > > + !!(bitmap_find_next_zero_area_off(bmap, bmap_len, 0, 33, 0, 0) > bmap_len)); > > Two last parameters are zero in all cases. Doesn't sound like an > exhaustive testing. Real users provide non-zero alignments, so please > you do. > > > +} > > + > > static void __init test_fill_set(void) > > { > > DECLARE_BITMAP(bmap, 1024); > > -- > > 2.34.1