From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f48.google.com (mail-yx1-f48.google.com [74.125.224.48]) (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 CB9DD3AFAE6 for ; Mon, 8 Jun 2026 21:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780955664; cv=none; b=uSh5Qnlk9obyCcJ7SKPQgG6R4+bEJW4ezG6DbxRGdJ2jlepPzgfWC99ymnc2OWUMvkgrHz8YOSbegZ65bS79pGBwTSL+GazoCVBQhI9vg2Yi0jQTAquGNaap5qwUuKbzKZf+I8KtCxKGHNYu3neJVATEPtTTfE+oNyqKeykTr24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780955664; c=relaxed/simple; bh=ShXYR+DvgSXQm8Ukj8eOSQ/obXEYrZhKmA3+sdhVGD8=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SOR8DrPJSP1M74lBBX9AXj3WF97faO6QxtWL48auJfVxYlkkOX3cN51Oxcq/SF90XOvjDmKXxZ9Vz79HgubtyX/TQF3zPiGr0hQdhRUwY7PlvLt6FHkFEEUdEagW0Xf7Eq0UWYI+bHFXSNIrmR2vbnSs/K426ukcFud9iVf+S9k= 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=l9pjAYoq; arc=none smtp.client-ip=74.125.224.48 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="l9pjAYoq" Received: by mail-yx1-f48.google.com with SMTP id 956f58d0204a3-6611669cd16so2411534d50.0 for ; Mon, 08 Jun 2026 14:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780955662; x=1781560462; 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=B3L5x126lWiemZAT3cvkNFi7ykzSSZgy0Q1xQambLAs=; b=l9pjAYoqSkhKNq5jHCaCbG9AdinJlVLDNRoGKa3PLqXHotNWltNizGWoC/mUGtmpg6 Rfy9Eh11pI1yOq5o4C9DiKxoqNlmjzt/V5WB2cJPIflbwaPXu9nLAkzpFjtHJaVx536w 8IcxrXh91x/9lo+oONir5cP1+EL8TpFuDbIypY67aK9T0IATv5HzChhJ8bxUSsLPM38p wi+TyNEHITgFovsOytHcpFtNHNew0j0e5FWmF+GDhSDkKZuOGBveDprtq/5SMviCRLrG mMf3cdcAnd/K/meIFCqHF4SkU24ZR7TMC1nMUUKlIK5EtEVNbH116/vHet0onkoSZzlz zwUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780955662; x=1781560462; 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=B3L5x126lWiemZAT3cvkNFi7ykzSSZgy0Q1xQambLAs=; b=FfKbh288/LlW3H/hX1iQWAbhxcGgnZ9aWi9lIo2CmI7DADjm+zwbUhdWnGzuwRSegQ OewzNM1ip6gU734ZehDAjyVRl35juC7z1EP76R6dPRXKcTLhIjN+eb8GQ9acLYN9D50R mTJA5sHD7Lk6Ks/y1nDRrsqxarW/bOdE2oAGsO9YcWuGv2RdCIEZBDgVIbDwX7S3Hgr/ t2pkq/4trAgMi0RBLZJ+Xz+FaNfjsnXoKGBJ0fn2a9UK0GLlLS9JF56jrly0Vw8I4ngt k1qcqfKaVHNEUX0BTAdMq+BPRF/R2j74w2hOGF4D+gjIVJSS1tBIu/a/9sQSuFHudZ6D zpkQ== X-Forwarded-Encrypted: i=1; AFNElJ/cBGLllZh8XoRr15wV/frWnFpKUDqyb4YzR9+WBKa7K21fGhyRqrB1RRdwWz+nua95CVKxzWvqVYvbgM4=@vger.kernel.org X-Gm-Message-State: AOJu0YzQKSpaNdStk7xiBVqvlLczvO5X8L7ua5usei4nt0nTrgXQVIXo JluTGYjg2mxOVpOmOXMMH1+xXrUw+igqrJ3ostlWu1oFM6kF+i9QdPbp X-Gm-Gg: Acq92OHI/OMJBYw4rAmceFexvGnB5tr0CLMZfJq9gtKJgcBda820wrb7MSRhzQxkdIQ wNIohb2Vr5e9rfg7ECW6lEp3r1W/ETpX2+TnzwCB+g574AbHvhuQgcoMLIdTjvpqtc89mtmYfFb QaWaUFy1VcXeSdAwPVLhiWQCjCJIQu4TQs90uGWMMIoC0bFlOwwK3n+o2trrvFZodkMxPaeIUxH w7dXHO0iLx0fZULsxfkx0pFeqN3z2rGIMyUAxrAQivjPBoyU+0nQQhimvZ4D/bKeqokDTmu1U83 vE4VLS8CZ8Xy1m0Jgdee5YggK6NGPOKK5AN8k3vZ4OcN2ibyvMUqJvIfo37ixlOUlqsDSw+KdQN UVTe3w87cwdBCWbkaBKJYl0vOGFKw/bm5OeGxiNSjgdgdQldPOvzIUnjNs2jKZvjduwswWOmUTO 1B3to4c8kdIhPTRX3j96OKJ3aKEcmq X-Received: by 2002:a53:bf10:0:b0:660:880f:d46d with SMTP id 956f58d0204a3-6610701b597mr10898680d50.63.1780955661671; Mon, 08 Jun 2026 14:54:21 -0700 (PDT) Received: from localhost ([50.221.107.122]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-661473db74asm756427d50.7.2026.06.08.14.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 14:54:21 -0700 (PDT) From: Yury Norov X-Google-Original-From: Yury Norov Date: Mon, 8 Jun 2026 17:54:20 -0400 To: Yi Sun Cc: yury.norov@gmail.com, mnazarewicz@gmail.com, akpm@linux-foundation.org, mina86@mina86.com, akinobu.mita@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 0/2] Improve the performance of bitmap_find_next_zero_area_off() Message-ID: References: <20260601094234.103863-1-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: <20260601094234.103863-1-yi.sun@unisoc.com> On Mon, Jun 01, 2026 at 05:42:32PM +0800, Yi Sun wrote: > Test code has been added to PATCH v2. > No new APIs were introduced. > > Testing with the test code showed a performance improvement > of approximately 70%. No, it's not. Your numbers show approximately 50% improvement for the dense case, and approximately 2% slowdown for the sparse case. > Test result(random): > orig_ns orig_cnt orig_average new_ns new_cnt new_average ratio > test1 1388885 1154 1203 462923 1308 353 70.7% > test2 1393616 1324 1052 736193 1212 607 42.3% > test3 1391693 1216 1144 735808 1260 583 49% > test4 1393231 1275 1092 742731 1402 529 51.6% > test5 1390731 1260 1103 737231 1274 578 47.6% > > Test result(sparse): > orig_ns orig_cnt orig_average new_ns new_cnt new_average ratio > test1 4496077 322477 13 2419462 322480 7 46.2% > test2 7514731 322482 23 5785808 322476 17 26.1% > test3 7490692 322493 23 7654423 322483 23 0% > test4 7474500 322469 23 7628230 322483 23 0% > test5 7452692 322481 23 7663116 322478 23 0% The numbers look quite inconsistent. The first measurements are significantly faster for almost all experiments. In the 'new sparse' case the first run is 4 times faster than the others. And the ratio 0% is simply wrong. Please, run the test on a real hardware, not virtualized. Please built-in the test, so it's executed at boot time, or make sure you're not running anything on parallel, like a GUI or networking. I gave your code a brief test on my qemu, and I have 43% improvement in the dense case, with p-value 0.001; and -8% for sparse bitmap, with the p-value 0.044, still significant. Overall not bad. But if some critical user has actually a sparse bitmap, he'll be disappointed. There's not that many actual users of the function. For v5, can you CC those from non-driver part, at least. (The ARM GIC counts as the non-driver, I believe.) > Test result explanation: > Test both random and sparse five times. > @orig_ns/cnt: Original version results. > @new_ns/cnt: Optimized test results. > @orig_average = orig_ns / orig_cnt > @new_average = new_ns / new_cnt > @ratio = (orig_average - new_average) / orig_average > > The test results show that the optimized version > improved performance in almost every test. > > --- > v3: https://lore.kernel.org/all/20260514090607.231387-1-yi.sun@unisoc.com > - Based on MichaƂ Nazarewicz's suggestion, > code optimization was performed on PATCH v1. We've got a special tag for it: Suggested-by. If the optimization is still there, please use the tag. Can you point to that suggestion? > v2: https://lore.kernel.org/all/20260514035644.4118050-1-yi.sun@unisoc.com > - Do not introduce find_last_bit_from(). > > v1: https://lore.kernel.org/all/20260512040659.2992142-1-yi.sun@unisoc.com > > > Yi Sun (2): > lib: bitmap: reduce the number of goto again in > bitmap_find_next_zero_area_off() > lib/bitmap: add tests for bitmap_find_next_zero_area_off() The patch order is wrong. You'd introduce the test first, then the improvement. I want to apply the 1st patch, then run the test, then apply the 2nd patch, and run the test again to compare. The way you're doing it now makes me reverting the patches, the useless work. Thanks, Yury > > lib/bitmap.c | 10 +++++++--- > lib/find_bit_benchmark.c | 17 +++++++++++++++++ > lib/test_bitmap.c | 28 ++++++++++++++++++++++++++++ > 3 files changed, 52 insertions(+), 3 deletions(-) > > -- > 2.34.1