All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Battersby <tonyb-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
To: Andy Shevchenko
	<andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Chaitra P B
	<chaitra.basappa-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Suganath Prabu Subramani
	<suganath-prabu.subramani-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Sathya Prakash
	<sathya.prakash-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Matthew Wilcox <willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"MPT-FusionLinux.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org"
	<MPT-FusionLinux.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH v3 08/10] dmapool: improve accuracy of debug statistics
Date: Wed, 8 Aug 2018 09:18:48 -0400	[thread overview]
Message-ID: <99f91604-f7ea-aaaa-fc15-3c1264603d0b@cybernetics.com> (raw)
In-Reply-To: <CAHp75Vcnf8m0zW+8Y8=fTE+F_bDjmaQpR0s2qiTdkOzqe2+fBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 08/08/2018 05:54 AM, Andy Shevchenko wrote:
> On Tue, Aug 7, 2018 at 7:49 PM, Tony Battersby <tonyb@cybernetics.com> 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.  Not
worth special-casing a slow path.

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Tony Battersby <tonyb@cybernetics.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Chaitra P B <chaitra.basappa@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"MPT-FusionLinux.pdl@broadcom.com"
	<MPT-FusionLinux.pdl@broadcom.com>
Subject: Re: [PATCH v3 08/10] dmapool: improve accuracy of debug statistics
Date: Wed, 8 Aug 2018 09:18:48 -0400	[thread overview]
Message-ID: <99f91604-f7ea-aaaa-fc15-3c1264603d0b@cybernetics.com> (raw)
In-Reply-To: <CAHp75Vcnf8m0zW+8Y8=fTE+F_bDjmaQpR0s2qiTdkOzqe2+fBA@mail.gmail.com>

On 08/08/2018 05:54 AM, Andy Shevchenko wrote:
> On Tue, Aug 7, 2018 at 7:49 PM, Tony Battersby <tonyb@cybernetics.com> 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.

  parent reply	other threads:[~2018-08-08 13:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 16:49 [PATCH v3 08/10] dmapool: improve accuracy of debug statistics Tony Battersby
2018-08-07 16:49 ` Tony Battersby
     [not found] ` <cbe2fb30-54b3-663e-4e30-448353723b8f-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
2018-08-08  9:54   ` Andy Shevchenko
2018-08-08  9:54     ` Andy Shevchenko
     [not found]     ` <CAHp75Vcnf8m0zW+8Y8=fTE+F_bDjmaQpR0s2qiTdkOzqe2+fBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-08 13:18       ` Tony Battersby [this message]
2018-08-08 13:18         ` Tony Battersby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99f91604-f7ea-aaaa-fc15-3c1264603d0b@cybernetics.com \
    --to=tonyb-vfae+i1/wji5uwnf+njydw@public.gmane.org \
    --cc=MPT-FusionLinux.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=chaitra.basappa-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sathya.prakash-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=suganath-prabu.subramani-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.