Re: [PATCH] tun: avoid high-order page allocation for packet header

From: Erdogan, Tahsin
Date: Mon Jul 31 2023 - 19:04:33 EST


Thanks Jakub for considering this patch.

On Mon, 2023-07-31 at 13:58 -0700, Jakub Kicinski wrote:
> On Tue, 25 Jul 2023 20:09:36 -0700 Tahsin Erdogan wrote:
> > @@ -1838,6 +1838,9 @@ static ssize_t tun_get_user(struct tun_struct
> > *tun, struct tun_file *tfile,
> > */
> > zerocopy = false;
> > } else {
> > + if (linear == 0)
> > + linear = min_t(size_t, good_linear,
> > copylen);
>
> nit: would you mind changing to !linear instead of linear == 0 ?

Yes, I will fix this in v2.


> Also - I don't see linear explicitly getting set to 0. What
> guarantees
> that? What's the story there?
linear is set to 0 in the earlier if block. When gso.hdr_len is 0,
linear also becomes 0:
if (!zerocopy) {
copylen = len;
if (tun16_to_cpu(tun, gso.hdr_len) > good_linear)
linear = good_linear;
else
linear = tun16_to_cpu(tun, gso.hdr_len);
}