From: Matthew Wilcox <willy@infradead.org>
To: Tony Battersby <tonyb@cybernetics.com>
Cc: 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, linux-mm@kvack.org,
linux-scsi@vger.kernel.org, MPT-FusionLinux.pdl@broadcom.com
Subject: Re: [PATCH v2 8/9] dmapool: reduce footprint in struct page
Date: Thu, 2 Aug 2018 16:56:26 -0700 [thread overview]
Message-ID: <20180802235626.GA5773@bombadil.infradead.org> (raw)
In-Reply-To: <0ccfd31b-0a3f-9ae8-85c8-e176cd5453a9@cybernetics.com>
On Thu, Aug 02, 2018 at 04:01:12PM -0400, Tony Battersby wrote:
> This is my attempt to shrink 'dma_free_o' and 'dma_in_use' in 'struct
> page' (originally 'offset' and 'in_use' in 'struct dma_page') to 16-bit
> so that it is unnecessary to use the '_mapcount' field of 'struct
> page'. However, it adds complexity and makes allocating and freeing up
> to 20% slower for little gain, so I am NOT recommending that it be
> merged at this time. I am posting it just for reference in case someone
> finds it useful in the future.
I spy some interesting pieces in here that I'd love you to submit as
patches for merging.
> One of the nice things about this is that dma_pool_free() can do some
> additional sanity checks:
> *) Check that the offset of the passed-in address corresponds to a valid
> block offset.
Can't we do that already? Subtract the base address of the page from
the passed-in vaddr and check it's a multiple of pool->size?
> struct dma_pool { /* the pool */
> #define POOL_FULL_IDX 0
> #define POOL_AVAIL_IDX 1
> #define POOL_N_LISTS 2
> struct list_head page_list[POOL_N_LISTS];
> spinlock_t lock;
> - size_t size;
> struct device *dev;
> - size_t allocation;
> - size_t boundary;
> + unsigned int size;
> + unsigned int allocation;
> + unsigned int boundary_shift;
> + unsigned int blks_per_boundary;
> + unsigned int blks_per_alloc;
s/size_t/unsigned int/ is a good saving on 64-bit systems. We recently
did something similar for slab/slub.
> @@ -141,6 +150,7 @@ static DEVICE_ATTR(pools, 0444, show_pool
> struct dma_pool *dma_pool_create(const char *name, struct device *dev,
> size_t size, size_t align, size_t boundary)
> {
We should change the API here too.
next prev parent reply other threads:[~2018-08-02 23:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 20:01 Tony Battersby
2018-08-02 23:56 ` Matthew Wilcox [this message]
2018-08-03 14:04 ` Tony Battersby
2018-08-03 14:49 ` 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=20180802235626.GA5773@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=chaitra.basappa@broadcom.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=linux-scsi@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=sathya.prakash@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.com \
--cc=tonyb@cybernetics.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox