From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: Sagi Grimberg
<sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
oren-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH RFC 2/2] IB/mlx5: Implement Fast Indirect Memory Registration Feature
Date: Mon, 20 Oct 2014 09:46:36 +0200 [thread overview]
Message-ID: <5444BDDC.1060507@acm.org> (raw)
In-Reply-To: <5444122C.6070804-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
On 10/19/14 21:34, Sagi Grimberg wrote:
> On 10/14/2014 8:41 AM, Bart Van Assche wrote:
>> > +struct ib_indir_reg_list *
>> > +mlx5_ib_alloc_indir_reg_list(struct ib_device *device,
>> > + unsigned int max_indir_list_len)
>>
>> There are three k[zc]alloc() calls in this function. Can these be
>> combined into one without increasing the chance too much that this will
>> increase the order of the allocation ?
>
> Well, I have 3 allocations:
> 1. mlx5_indir_reg_list container
> 2. sg_list: buffer of sg elements for the user to pass
> 3. mapped_ilist: buffer for HW representation of sg elements.
>
> mapped_ilist buffer has some constraints on it (see below) so I can't
> combine it with the other two. I assume I can rearrange the structure to
> combine the fist 2 allocations together, but it can trigger a higher
> order allocation (unless I use vzalloc, but I'm not sure what is the
> benefit here...).
Since vmalloc() is about 1000 times slower than kmalloc() I think we
should try to avoid vmalloc() and its variants. Combining multiple
kmalloc() calls into a single kmalloc() call helps performance and
reduces the number of error paths. But since the time needed for a
single kmalloc() call is only a few microseconds combining multiple
kmalloc() calls reduces performance if combining kmalloc() calls
increases the allocation order from one page to multiple pages.
>> > + dsize = sizeof(*mirl->klms) * max_indir_list_len;
>> > + mirl->mapped_ilist = kzalloc(dsize + MLX5_UMR_ALIGN - 1,
>> > + GFP_KERNEL);
>>
>> The value of the constant MLX5_UMR_ALIGN is 2048. Does that mean this
>> code will always allocate 2 KB more than needed ? Is this really the
>> minimum alignment required for this data structure ? How likely is it
>> that this code will trigger a higher order allocation ?
>
> Well, here I need a variable size physically contiguous allocation with
> a start address aligned to 2K (HW requirement). So yes, with this code
> given the user allocate more than PAGE_SIZE-2K ib_sges, a higher order
> allocation will be triggered.
>
> I allocate 2K more to ensure I can align to 2K, then I set mirl->klms to
> point at the aligned address. Any idea on how can I do this without
> allocating 2K more?
Specifying a minimum memory alignment requirement is possible with
kmem_cache_create(). However, kmem_caches only support allocation of
fixed size objects.
In mm/slab_common.c one can see that for SLAB and SLUB allocations of >=
256 bytes are guaranteed to be aligned on a boundary equal to the
smallest power of two that is larger than or equal to the allocation
size. Unfortunately this does not hold for the SLOB allocator. So I
think the only change that can be made in this code without complicating
it too much is changing the "MLX5_UMR_ALIGN - 1" into
"max(MLX5_UMR_ALIGN - ARCH_KMALLOC_MINALIGN, 0)".
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-10-20 7:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 14:47 [PATCH RFC 0/2] Indirect Fast Memory registration support Sagi Grimberg
[not found] ` <1412693281-6161-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-10-07 14:48 ` [PATCH RFC 1/2] IB/core: Introduce Fast Indirect Memory Registration verbs API Sagi Grimberg
[not found] ` <1412693281-6161-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-10-07 18:12 ` Steve Wise
[not found] ` <54342D0C.6050103-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2014-10-08 5:48 ` Sagi Grimberg
[not found] ` <5434D037.4040208-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-08 13:54 ` Steve Wise
2014-10-13 7:57 ` Sagi Grimberg
[not found] ` <543B85F7.1060000-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-13 14:41 ` Steve Wise
2014-10-14 5:40 ` Bart Van Assche
[not found] ` <543CB76B.7020208-HInyCGIudOg@public.gmane.org>
2014-10-19 19:01 ` Sagi Grimberg
[not found] ` <54440A7E.200-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-20 14:54 ` Steve Wise
2014-10-07 14:48 ` [PATCH RFC 2/2] IB/mlx5: Implement Fast Indirect Memory Registration Feature Sagi Grimberg
[not found] ` <1412693281-6161-3-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-10-12 19:39 ` Or Gerlitz
[not found] ` <543AD8DE.5060404-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-10-13 8:32 ` Sagi Grimberg
[not found] ` <543B8E09.6090606-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-13 12:57 ` Or Gerlitz
2014-10-13 13:00 ` Or Gerlitz
2014-10-21 13:12 ` Eli Cohen
2014-10-14 5:41 ` Bart Van Assche
[not found] ` <543CB79B.6050400-HInyCGIudOg@public.gmane.org>
2014-10-14 10:50 ` Sagi Grimberg
2014-10-19 19:34 ` Sagi Grimberg
[not found] ` <5444122C.6070804-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-20 7:46 ` Bart Van Assche [this message]
[not found] ` <5444BDDC.1060507-HInyCGIudOg@public.gmane.org>
2014-10-21 9:32 ` Sagi Grimberg
[not found] ` <54462842.8080701-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-21 10:54 ` Bart Van Assche
[not found] ` <54463B4A.1070308-HInyCGIudOg@public.gmane.org>
2014-10-21 10:59 ` Sagi Grimberg
2014-10-21 14:20 ` Eli Cohen
2014-10-21 14:30 ` Sagi Grimberg
2014-10-08 11:06 ` [PATCH RFC 0/2] Indirect Fast Memory registration support Devesh Sharma
[not found] ` <EE7902D3F51F404C82415C4803930ACD40C4114B-DWYeeINJQrxExQ8dmkPuX0M9+F4ksjoh@public.gmane.org>
2014-10-13 8:01 ` Sagi Grimberg
2014-10-12 19:43 ` Or Gerlitz
[not found] ` <543AD9CD.80803-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-10-13 8:48 ` Bart Van Assche
[not found] ` <543B91E2.70206-HInyCGIudOg@public.gmane.org>
2014-10-13 11:18 ` Sagi Grimberg
[not found] ` <543BB4F4.8090203-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-10-13 14:51 ` Steve Wise
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=5444BDDC.1060507@acm.org \
--to=bvanassche-hinycgiudog@public.gmane.org \
--cc=eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=oren-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).