From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id 52A546B0010 for ; Wed, 8 Aug 2018 09:18:51 -0400 (EDT) Received: by mail-qk0-f198.google.com with SMTP id w14-v6so2233446qkw.2 for ; Wed, 08 Aug 2018 06:18:51 -0700 (PDT) Received: from mail.cybernetics.com (mail.cybernetics.com. [173.71.130.66]) by mx.google.com with ESMTPS id i8-v6si3445827qkm.41.2018.08.08.06.18.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 06:18:50 -0700 (PDT) Subject: Re: [PATCH v3 08/10] dmapool: improve accuracy of debug statistics References: From: Tony Battersby Message-ID: <99f91604-f7ea-aaaa-fc15-3c1264603d0b@cybernetics.com> Date: Wed, 8 Aug 2018 09:18:48 -0400 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: owner-linux-mm@kvack.org List-ID: To: Andy Shevchenko Cc: Matthew Wilcox , Christoph Hellwig , Marek Szyprowski , Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , "iommu@lists.linux-foundation.org" , "linux-mm@kvack.org" , "linux-scsi@vger.kernel.org" , "MPT-FusionLinux.pdl@broadcom.com" On 08/08/2018 05:54 AM, Andy Shevchenko wrote: > On Tue, Aug 7, 2018 at 7:49 PM, Tony Battersby wrote: >> The "total number of blocks in pool" debug statistic currently does not >> take the boundary value into account, so it diverges from the "total >> number of blocks in use" statistic when a boundary is in effect. Add a >> calculation for the number of blocks per allocation that takes the >> boundary into account, and use it to replace the inaccurate calculation. > >> + retval->blks_per_alloc = >> + (allocation / boundary) * (boundary / size) + >> + (allocation % boundary) / size; > If boundary is guaranteed to be power of 2, this can avoid cost > divisions (though it's a slow path anyway). > At this point in the function, boundary is guaranteed to be either a power of 2 or equal to allocation, which might not be a power of 2.A Not worth special-casing a slow path.