From: Alexander Duyck <alexander.h.duyck@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux-mm@kvack.org, netdev@vger.kernel.org,
akpm@linux-foundation.org, davem@davemloft.net
Subject: Re: [net-next PATCH 1/6] net: Add skb_free_frag to replace use of put_page in freeing skb->head
Date: Mon, 04 May 2015 19:49:53 -0700 [thread overview]
Message-ID: <55482FD1.5060707@redhat.com> (raw)
In-Reply-To: <1430785003.27254.20.camel@edumazet-glaptop2.roam.corp.google.com>
On 05/04/2015 05:16 PM, Eric Dumazet wrote:
> On Mon, 2015-05-04 at 16:14 -0700, Alexander Duyck wrote:
>> This change adds a function called skb_free_frag which is meant to
>> compliment the function __alloc_page_frag. The general idea is to enable a
>> more lightweight version of page freeing since we don't actually need all
>> the overhead of a put_page, and we don't quite fit the model of __free_pages.
>
> Could you describe what are the things that put_page() handle that we
> don't need for skb frags ?
A large part of it is just all the extra code flow with each level
having to retest flags. So if you follow the calls for put_page w/ a
page frag you end up with something like:
skb_free_head - virt_to_head_page
put_page() - (Head | Tail)
put_compound_page() - Tail, Head, _count
__put_compound_page() - compound_dtor
__page_cache_release() - LRU, mem_cgroup
free_compound_page() - Head, compound_order
__free_pages_ok()
If I free the same page frag in skb_frag_free the path ends up looking like:
skb_free_head - inlined by compiler
skb_free_frag - virt_to_head_page, count, head, order
__free_pages_ok()
> It looks the change could benefit to other users (outside of networking)
It could, but there are also other mechanisms already in place for
freeing pages. For example in the Intel drivers I had gotten into the
habit of using __free_pages for Rx pages since it does exactly the same
thing but you need to know the order of the pages you are freeing before
you can use it. In the case of head frags we don't really know that
since it can be a page fragment given to us by any of the drivers using
alloc_pages.
The motivation behind creating a centralized function was to take care
of the virt_to_head_page and compound_order portions of this in one
centralized spot. It avoids bloating things as I'm able to get away
with little tricks like combining the compound_order Head flag check
with the one to determine if I call the compound freeing function or the
order 0 one.
- Alex
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-05-05 2:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 23:14 [net-next PATCH 0/6] Add skb_free_frag to replace put_page(virt_to_head_page(ptr)) Alexander Duyck
2015-05-04 23:14 ` [net-next PATCH 1/6] net: Add skb_free_frag to replace use of put_page in freeing skb->head Alexander Duyck
2015-05-05 0:16 ` Eric Dumazet
2015-05-05 2:49 ` Alexander Duyck [this message]
2015-05-06 19:38 ` Andrew Morton
2015-05-06 20:27 ` Alexander Duyck
2015-05-06 20:41 ` Andrew Morton
2015-05-06 20:55 ` Alexander Duyck
2015-05-04 23:14 ` [net-next PATCH 2/6] netcp: Replace put_page(virt_to_head_page(ptr)) w/ skb_free_frag Alexander Duyck
2015-05-04 23:14 ` [net-next PATCH 3/6] mvneta: " Alexander Duyck
2015-05-04 23:15 ` [net-next PATCH 4/6] e1000: Replace e1000_free_frag with skb_free_frag Alexander Duyck
2015-05-05 0:28 ` Jeff Kirsher
2015-05-04 23:15 ` [net-next PATCH 5/6] hisilicon: Replace put_page(virt_to_head_page()) with skb_free_frag() Alexander Duyck
2015-05-04 23:15 ` [net-next PATCH 6/6] bnx2x, tg3: " Alexander Duyck
2015-05-05 23:28 ` [net-next PATCH 0/6] Add skb_free_frag to replace put_page(virt_to_head_page(ptr)) David Miller
-- strict thread matches above, loose matches on Subject: below --
2015-05-04 23:09 [net-next PATCH 1/6] net: Add skb_free_frag to replace use of put_page in freeing skb->head Alexander Duyck
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=55482FD1.5060707@redhat.com \
--to=alexander.h.duyck@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).