From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Bart Van Assche <Bart.VanAssche@wdc.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"tvrtko.ursulin@intel.com" <tvrtko.ursulin@intel.com>,
"hare@suse.com" <hare@suse.com>,
"jthumshirn@suse.de" <jthumshirn@suse.de>,
"target-devel@vger.kernel.org" <target-devel@vger.kernel.org>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"nab@linux-iscsi.org" <nab@linux-iscsi.org>
Subject: Re: [PATCH 6/6] lib/scatterlist: Drop order argument from sgl_free_n_order
Date: Wed, 7 Mar 2018 17:23:21 +0000 [thread overview]
Message-ID: <37786476-a4e8-ce70-abff-35d99413fa68@ursulin.net> (raw)
In-Reply-To: <1520439817.2890.21.camel@wdc.com>
On 07/03/18 16:23, Bart Van Assche wrote:
> On Wed, 2018-03-07 at 12:47 +0000, Tvrtko Ursulin wrote:
>> We can derive the order from sg->length and so do not need to pass it in
>> explicitly. Rename the function to sgl_free_n.
>
> Using get_order() to compute the order looks fine to me but this patch will
> have to rebased in order to address the comments on the previous patches.
Ok I guess my main questions are the ones from the cover letter - where
is this API going and why did it get in a bit of a funky state? Because
it doesn't look fully thought through and tested to me.
My motivation is that I would like to extend it to add
sgl_alloc_order_min_max, which takes min order and max order, and
allocates as large chunks as it can given those constraints. This is
something we have in i915 and could then drop our implementation and use
the library function.
But I also wanted to refactor sgl_alloc_order to benefit from the
existing chained struct scatterlist allocator. But SGL API does not
embed into struct sg_table, neither it carries explicitly the number of
nents allocated, making it impossible to correctly free with existing
sg_free_table.
Another benefit of using the existing sg allocator would be that for
large allocation you don't depend on the availability of contiguous
chunks like you do with kmalloc_array.
For instance if in another reply you mentioned 4GiB allocations are a
possibility. If you use order 0 that means you need 1M nents, which can
be something like 32 bytes each and you need a 32MiB kmalloc for the
nents array and thats quite big. If you would be able to reuse the
existing sg_alloc_table infrastructure (I have patches which extract it
if you don't want to deal with struct sg_table), you would benefit from
PAGE_SIZE allocations.
Also I am not sure if a single gfp argument to sgl_alloc_order is the
right thing to do. I have a feeling you either need to ignore it for
kmalloc_array, or pass in two gfp_t arguments to be used for metadata
and backing storage respectively.
So I have many questions regarding the current state and future
direction, but essentially would like to make it usable for other
drivers, like i915, as well.
Regards,
Tvrtko
next prev parent reply other threads:[~2018-03-07 17:23 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 12:47 [PATCH 0/6] lib/scatterlist: Small SGL tidy Tvrtko Ursulin
2018-03-07 12:47 ` [PATCH 1/6] lib/scatterlist: Tidy types and fix overflow checking in sgl_alloc_order Tvrtko Ursulin
2018-03-07 16:10 ` Bart Van Assche
2018-03-07 17:06 ` Tvrtko Ursulin
2018-03-09 14:04 ` Tvrtko Ursulin
2018-03-07 12:47 ` [PATCH 2/6] lib/scatterlist: Skip requesting zeroed allocations " Tvrtko Ursulin
2018-03-07 15:35 ` Andy Shevchenko
2018-03-07 17:31 ` Tvrtko Ursulin
2018-03-07 12:47 ` [PATCH 3/6] lib/scatterlist: Do not leak pages when high-order allocation fails Tvrtko Ursulin
2018-03-07 16:16 ` Bart Van Assche
2018-03-07 17:06 ` Tvrtko Ursulin
2018-03-07 12:47 ` [PATCH 4/6] lib/scatterlist: Unexport some trivial wrappers Tvrtko Ursulin
2018-03-07 16:19 ` Bart Van Assche
2018-03-07 17:10 ` Tvrtko Ursulin
2018-03-07 12:47 ` [PATCH 5/6] lib/scatterlist: Drop unused sgl_free_order Tvrtko Ursulin
2018-03-07 12:47 ` [PATCH 6/6] lib/scatterlist: Drop order argument from sgl_free_n_order Tvrtko Ursulin
2018-03-07 16:23 ` Bart Van Assche
2018-03-07 17:23 ` Tvrtko Ursulin [this message]
2018-03-07 17:33 ` Bart Van Assche
2018-03-07 18:30 ` James Bottomley
2018-03-08 7:59 ` Tvrtko Ursulin
2018-03-08 15:56 ` Bart Van Assche
2018-03-08 17:06 ` Tvrtko Ursulin
2018-03-07 18:38 ` [PATCH 0/6] lib/scatterlist: Small SGL tidy Bart Van Assche
2018-03-08 8:04 ` Tvrtko Ursulin
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=37786476-a4e8-ce70-abff-35d99413fa68@ursulin.net \
--to=tursulin@ursulin.net \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.com \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=target-devel@vger.kernel.org \
--cc=tvrtko.ursulin@intel.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
all inboxes | Powered by JetHome®