Re: [PATCH] net: sock: Add option for memory optimized hints.

From: Eric Dumazet
Date: Fri May 20 2016 - 13:33:21 EST


On Fri, 2016-05-20 at 15:36 +0200, peter enderborg wrote:
> From: Peter Enderborg <peter.enderborg@xxxxxxxxxxxxxx>
>
> When sending data the socket allocates memory for
> payload on a cache or a page alloc. The page alloc
> then might trigger compation that takes long time.
> This can be avoided with smaller chunks. But
> userspace can not know what is the right size for
> the smaller sends. For this we add a SIZEHINT
> getsocketopt where the userspace can get the size
> for send that will fit into one page (order 0) or
> the max for a slab cache allocation.


Very obscure thing if you ask me. Exposing kernel internals like that
seems to work around a more serious issue.

What kind of sockets would ever use KMALLOC_MAX_CACHE_SIZE allocations
exactly ?

af_unix and tcp are definitely clean.

28d6427109d13b0f447cba5761f88d3548e83605 net: attempt high order allocations in sock_alloc_send_pskb()
e370a7236321773245c5522d8bb299380830d3b2 af_unix: improve STREAM behavior with fragmented memory
eb6a24816b247c0be6b2e97e68933072874bbe54 af_unix: reduce high order page allocations