From: Rusty Russell <rusty@rustcorp.com.au>
To: Mike Waychison <mikew@google.com>
Cc: netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [RFC PATCH v1 2/2] virtio_net: Don't disable napi on low memory.
Date: Mon, 09 Jan 2012 17:16:52 +1030 [thread overview]
Message-ID: <877h119xur.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAGTjWtBbLtm47kozBC2fdwGYKsOooQec0W9PwUEAF58mYDioaQ@mail.gmail.com>
On Fri, 6 Jan 2012 09:54:46 -0800, Mike Waychison <mikew@google.com> wrote:
> On Wed, Jan 4, 2012 at 6:46 PM, Mike Waychison <mikew@google.com> wrote:
> > On Wed, Jan 4, 2012 at 4:31 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> >> 4) You use the skb data for the linked list; use the skb head's list.
>
> What did you mean by this? I was under the impression that the ->next
> and ->prev fields in sk_buff were the first two elements specifically
> so that the pointer could be treated as a list_head. If it's the cast
> in particular that you have an objection with, I can easily change
> this to a singly linked list threaded through ->next if that's
> cleaner.
Yep, I saw the cast and misread your code. I could have sworn that skb
used a real list_head these days, but I'm wrong.
> >>
> >> Instead, here's how I think it should be done:
> ...
> >
> > This sounds reasonable to me. I'll see what I can muster together this week.
> >
>
> So I started implementing it the way you were mentioning, and ran into
> a problem with the original patchset.
>
> Currently the "mergeable" and "big" receive buffers use a private page
> free list (virtnet_info->pages) which has no synchronization itself.
> This means that the batched version can't use get_a_page() and
> give_pages() as is, which reduces the need to re-use the same alloc
> halves that I've split. Alternatives I can think of at this point:
>
> - pass in a flag to the allocators like "bool is_serial" that is true
> if we are serializing with napi, (which determines if we can much with
> vi->pages)
> or
> - not use the same allocators for the "mergeable" and "big" paths.
> The mergeable allocator in the non-serialized case reduces to
> alloc_page(), while the big allocator looks like a copy and paste that
> uses alloc_page instead of get_a_page().
>
> Preferences? I'll code one of the two up and see what it looks like.
Whatever results in a cleaner driver, I'm happy.
Thanks,
Rusty.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: Rusty Russell <rusty@rustcorp.com.au>
To: Mike Waychison <mikew@google.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [RFC PATCH v1 2/2] virtio_net: Don't disable napi on low memory.
Date: Mon, 09 Jan 2012 17:16:52 +1030 [thread overview]
Message-ID: <877h119xur.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAGTjWtBbLtm47kozBC2fdwGYKsOooQec0W9PwUEAF58mYDioaQ@mail.gmail.com>
On Fri, 6 Jan 2012 09:54:46 -0800, Mike Waychison <mikew@google.com> wrote:
> On Wed, Jan 4, 2012 at 6:46 PM, Mike Waychison <mikew@google.com> wrote:
> > On Wed, Jan 4, 2012 at 4:31 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> >> 4) You use the skb data for the linked list; use the skb head's list.
>
> What did you mean by this? I was under the impression that the ->next
> and ->prev fields in sk_buff were the first two elements specifically
> so that the pointer could be treated as a list_head. If it's the cast
> in particular that you have an objection with, I can easily change
> this to a singly linked list threaded through ->next if that's
> cleaner.
Yep, I saw the cast and misread your code. I could have sworn that skb
used a real list_head these days, but I'm wrong.
> >>
> >> Instead, here's how I think it should be done:
> ...
> >
> > This sounds reasonable to me. I'll see what I can muster together this week.
> >
>
> So I started implementing it the way you were mentioning, and ran into
> a problem with the original patchset.
>
> Currently the "mergeable" and "big" receive buffers use a private page
> free list (virtnet_info->pages) which has no synchronization itself.
> This means that the batched version can't use get_a_page() and
> give_pages() as is, which reduces the need to re-use the same alloc
> halves that I've split. Alternatives I can think of at this point:
>
> - pass in a flag to the allocators like "bool is_serial" that is true
> if we are serializing with napi, (which determines if we can much with
> vi->pages)
> or
> - not use the same allocators for the "mergeable" and "big" paths.
> The mergeable allocator in the non-serialized case reduces to
> alloc_page(), while the big allocator looks like a copy and paste that
> uses alloc_page instead of get_a_page().
>
> Preferences? I'll code one of the two up and see what it looks like.
Whatever results in a cleaner driver, I'm happy.
Thanks,
Rusty.
next prev parent reply other threads:[~2012-01-09 6:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-04 22:52 [RFC PATCH v1 0/2] virtio_net: Better low memory handling Mike Waychison
2012-01-04 22:52 ` [RFC PATCH v1 1/2] virtio_net: Pass gfp flags when allocating rx buffers Mike Waychison
2012-01-04 22:52 ` Mike Waychison
2012-01-05 0:10 ` Rusty Russell
2012-01-05 18:21 ` David Miller
2012-01-05 18:21 ` David Miller
2012-01-04 22:52 ` [RFC PATCH v1 2/2] virtio_net: Don't disable napi on low memory Mike Waychison
2012-01-04 22:52 ` Mike Waychison
2012-01-05 0:31 ` Rusty Russell
2012-01-05 2:46 ` Mike Waychison
2012-01-05 2:46 ` Mike Waychison
2012-01-06 17:54 ` Mike Waychison
2012-01-06 17:54 ` Mike Waychison
2012-01-09 6:46 ` Rusty Russell [this message]
2012-01-09 6:46 ` Rusty Russell
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=877h119xur.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mikew@google.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/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 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.