From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbdK3NfI (ORCPT ); Thu, 30 Nov 2017 08:35:08 -0500 Received: from www262.sakura.ne.jp ([202.181.97.72]:24392 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750964AbdK3NfH (ORCPT ); Thu, 30 Nov 2017 08:35:07 -0500 To: wei.w.wang@intel.com Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, mst@redhat.com, mhocko@kernel.org, akpm@linux-foundation.org, mawilcox@microsoft.com, david@redhat.com, cornelia.huck@de.ibm.com, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, willy@infradead.org, liliang.opensource@gmail.com, yang.zhang.wz@gmail.com, quan.xu@aliyun.com, nilal@redhat.com, riel@redhat.com Subject: Re: [PATCH v18 05/10] xbitmap: add more operations From: Tetsuo Handa References: <1511963726-34070-1-git-send-email-wei.w.wang@intel.com> <1511963726-34070-6-git-send-email-wei.w.wang@intel.com> <201711301934.CDC21800.FSLtJFFOOVQHMO@I-love.SAKURA.ne.jp> In-Reply-To: <201711301934.CDC21800.FSLtJFFOOVQHMO@I-love.SAKURA.ne.jp> Message-Id: <201711302235.FAJ57385.OFJHOVQOFtMSFL@I-love.SAKURA.ne.jp> X-Mailer: Winbiff [Version 2.51 PL2] X-Accept-Language: ja,en,zh Date: Thu, 30 Nov 2017 22:35:03 +0900 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tetsuo Handa wrote: > > + > > + if (ebit >= BITS_PER_LONG) > > + continue; > > (I don't understand how radix tree works, but generally this patchset looks fuzzy > to me about boundary cases. Thus, I want to confirm that this is not an overlook.) > Why is making "ebit >= BITS_PER_LONG" (e.g. start == 62) case a no-op correct? > Aren't there bits which should have been cleared in this case? According to xb_set_bit(), it seems to me that we are trying to avoid memory allocation for "struct ida_bitmap" when all set bits within a 1024-bits bitmap reside in the first 61 bits. But does such saving help? Is there characteristic bias that majority of set bits resides in the first 61 bits, for "bit" is "unsigned long" which holds a page number (isn't it)? If no such bias, wouldn't eliminating radix_tree_exception() case and always storing "struct ida_bitmap" simplifies the code (and make the processing faster)?