Re: [PATCH rdma-next 3/4] lib/scatterlist: Add support in dynamic allocation of SG table from pages

From: Christoph Hellwig
Date: Tue Sep 08 2020 - 15:39:54 EST


On Mon, Sep 07, 2020 at 03:44:08PM +0300, Maor Gottlieb wrote:
>>> +{
>>> +#ifdef CONFIG_ARCH_NO_SG_CHAIN
>>> + if (append->left_pages)
>>> + return ERR_PTR(-EOPNOTSUPP);
>>> +#endif
>> Which makes this API entirely useless for !CONFIG_ARCH_NO_SG_CHAIN,
>> doesn't it? Wouldn't it make more sense to not provide it for that
>> case and add an explicitl dependency in the callers?
>
> Current implementation allow us to support small memory registration which
> not require chaining. I am not aware which archs has the SG_CHAIN support
> and I don't want to break it so I can't add it to as dependency to the
> Kconfig. Another option is to do the logic in the caller, but it isn't
> clean.

But does the caller handle the -EOPNOTSUPP properly? I think right now
it will just fail the large registration that worked before this patchset.

Given that ARCH_NO_SG_CHAIN is only true for alpha, parisc and a few
arm subarchitectures I think just not supporting umem is probably
cleared. And eventually we'll need to drop ARCH_NO_SG_CHAIN entirely.