From: Menglong Dong <menglong8.dong@gmail.com>
To: Jon Maloy <jmaloy@redhat.com>
Cc: ying.xue@windriver.com, David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
tipc-discussion@lists.sourceforge.net,
LKML <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>
Subject: Re: The value of FB_MTU eats two pages
Date: Thu, 3 Jun 2021 10:26:55 +0800 [thread overview]
Message-ID: <CADxym3ZdyqJ7b_PqdcjbNhKWP7_nsPRQ9Q0TtFC6Qzr75ekK+g@mail.gmail.com> (raw)
In-Reply-To: <e91baaba-e00a-4b16-0787-e9460dacfbb9@redhat.com>
Hello Maloy,
On Thu, Jun 3, 2021 at 3:50 AM Jon Maloy <jmaloy@redhat.com> wrote:
[...]
> Hi Dong,
> The value is based on empiric knowledge.
> When I determined it I made a small loop in a kernel driver where I
> allocated skbs (using tipc_buf_acquire) with an increasing size
> (incremented with 1 each iteration), and then printed out the
> corresponding truesize.
>
> That gave the value we are using now.
>
> Now, when re-running the test I get a different value, so something has
> obviously changed since then.
>
> [ 1622.158586] skb(513) =>> truesize 2304, prev skb(512) => prev
> truesize 1280
> [ 1622.162074] skb(1537) =>> truesize 4352, prev skb(1536) => prev
> truesize 2304
> [ 1622.165984] skb(3585) =>> truesize 8448, prev skb(3584) => prev
> truesize 4352
>
> As you can see, the optimal value now, for an x86_64 machine compiled
> with gcc, is 3584 bytes, not 3744.
I'm not sure if this is a perfect way to determine the value of FB_MTU.
If 'struct skb_shared_info' changes, this value seems should change,
too.
How about we make it this:
#define FB_MTU (PAGE_SIZE - \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) - \
SKB_DATA_ALIGN(BUF_HEADROOM + BUF_TAILROOM + 3 + \
MAX_H_SIZ))
The value 'BUF_HEADROOM + BUF_TAILROOM + 3' come from 'tipc_buf_acquire()':
#ifdef CONFIG_TIPC_CRYPTO
unsigned int buf_size = (BUF_HEADROOM + size + BUF_TAILROOM + 3) & ~3u;
#else
unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
#endif
Is it a good idea?
Thanks
Menglong Dong
next prev parent reply other threads:[~2021-06-03 2:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 14:18 Menglong Dong
2021-06-02 19:50 ` Jon Maloy
2021-06-03 2:26 ` Menglong Dong [this message]
2021-06-03 13:08 ` Jon Maloy
2021-06-03 14:54 ` Menglong Dong
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=CADxym3ZdyqJ7b_PqdcjbNhKWP7_nsPRQ9Q0TtFC6Qzr75ekK+g@mail.gmail.com \
--to=menglong8.dong@gmail.com \
--cc=davem@davemloft.net \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
--subject='Re: The value of FB_MTU eats two pages' \
/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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.