From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by kanga.kvack.org (Postfix) with ESMTP id 773BB6B0038 for ; Tue, 29 Nov 2016 13:23:11 -0500 (EST) Received: by mail-pg0-f70.google.com with SMTP id q10so445615153pgq.7 for ; Tue, 29 Nov 2016 10:23:11 -0800 (PST) Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com. [2607:f8b0:400e:c05::244]) by mx.google.com with ESMTPS id 63si60917176pfm.160.2016.11.29.10.23.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 10:23:10 -0800 (PST) Received: by mail-pg0-x244.google.com with SMTP id x23so17100688pgx.3 for ; Tue, 29 Nov 2016 10:23:10 -0800 (PST) Subject: [mm PATCH 0/3] Page fragment updates From: Alexander Duyck Date: Tue, 29 Nov 2016 10:23:08 -0800 Message-ID: <20161129182010.13445.31256.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org This patch series takes care of a few cleanups for the page fragments API. First we do some renames so that things are much more consistent. First we move the page_frag_ portion of the name to the front of the functions names. Secondly we split out the cache specific functions from the other page fragment functions by adding the word "cache" to the name. Second I did some minor clean-up on the function calls so that they are more inline with the existing __free_pages calls in terms of how they operate. Finally I added a bit of documentation that will hopefully help to explain some of this. I plan to revisit this later as we get things more ironed out in the near future with the changes planned for the DMA setup to support eXpress Data Path. --- Alexander Duyck (3): mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free mm: Rename __page_frag functions to __page_frag_cache, drop order from drain mm: Add documentation for page fragment APIs Documentation/vm/page_frags | 42 +++++++++++++++++++++++++++++ drivers/net/ethernet/intel/igb/igb_main.c | 6 ++-- include/linux/gfp.h | 9 +++--- include/linux/skbuff.h | 2 + mm/page_alloc.c | 33 +++++++++++++---------- net/core/skbuff.c | 8 +++--- 6 files changed, 73 insertions(+), 27 deletions(-) create mode 100644 Documentation/vm/page_frags -- -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 41F916B0253 for ; Tue, 29 Nov 2016 13:23:18 -0500 (EST) Received: by mail-pg0-f71.google.com with SMTP id y71so445000279pgd.0 for ; Tue, 29 Nov 2016 10:23:18 -0800 (PST) Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com. [2607:f8b0:400e:c00::243]) by mx.google.com with ESMTPS id g189si60995796pfb.281.2016.11.29.10.23.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 10:23:17 -0800 (PST) Received: by mail-pf0-x243.google.com with SMTP id y68so8741440pfb.1 for ; Tue, 29 Nov 2016 10:23:17 -0800 (PST) Subject: [mm PATCH 1/3] mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free From: Alexander Duyck Date: Tue, 29 Nov 2016 10:23:15 -0800 Message-ID: <20161129182315.13445.17597.stgit@localhost.localdomain> In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org From: Alexander Duyck This patch renames the page frag functions to be more consistent with other APIs. Specifically we place the name page_frag first in the name and then have either an alloc or free call name that we append as the suffix. This makes it a bit clearer in terms of naming. In addition we drop the leading double underscores since we are technically no longer a backing interface and instead the front end that is called from the networking APIs. The last bit I changed is I rebased page_frag_free to actually function very similar to the function free_pages, the only real difference now is the fact that we have to get the page order by calling compound page instead of having it passed as a part of the function call. Signed-off-by: Alexander Duyck --- include/linux/gfp.h | 6 +++--- include/linux/skbuff.h | 2 +- mm/page_alloc.c | 20 ++++++++++++-------- net/core/skbuff.c | 8 ++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 4175dca4ac39..6238c74e0a01 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -508,9 +508,9 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, struct page_frag_cache; extern void __page_frag_drain(struct page *page, unsigned int order, unsigned int count); -extern void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask); -extern void __free_page_frag(void *addr); +extern void *page_frag_alloc(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask); +extern void page_frag_free(void *addr); #define __free_page(page) __free_pages((page), 0) #define free_page(addr) free_pages((addr), 0) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9c535fbccf2c..95799826a1e7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2471,7 +2471,7 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, static inline void skb_free_frag(void *addr) { - __free_page_frag(addr); + page_frag_free(addr); } void *napi_alloc_frag(unsigned int fragsz); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bb668eab5ee4..4218795a4694 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3931,8 +3931,8 @@ void __page_frag_drain(struct page *page, unsigned int order, } EXPORT_SYMBOL(__page_frag_drain); -void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask) +void *page_frag_alloc(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask) { unsigned int size = PAGE_SIZE; struct page *page; @@ -3983,19 +3983,23 @@ void *__alloc_page_frag(struct page_frag_cache *nc, return nc->va + offset; } -EXPORT_SYMBOL(__alloc_page_frag); +EXPORT_SYMBOL(page_frag_alloc); /* * Frees a page fragment allocated out of either a compound or order 0 page. */ -void __free_page_frag(void *addr) +void page_frag_free(void *addr) { - struct page *page = virt_to_head_page(addr); + struct page *page; + + if (addr != 0) { + VM_BUG_ON(!virt_addr_valid(addr)); + page = virt_to_head_page(addr); - if (unlikely(put_page_testzero(page))) - __free_pages_ok(page, compound_order(page)); + __free_pages(page, compound_order(page)); + } } -EXPORT_SYMBOL(__free_page_frag); +EXPORT_SYMBOL(page_frag_free); static void *make_alloc_exact(unsigned long addr, unsigned int order, size_t size) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4c96cb18c214..6cf779a9ad4c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -369,7 +369,7 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) local_irq_save(flags); nc = this_cpu_ptr(&netdev_alloc_cache); - data = __alloc_page_frag(nc, fragsz, gfp_mask); + data = page_frag_alloc(nc, fragsz, gfp_mask); local_irq_restore(flags); return data; } @@ -391,7 +391,7 @@ static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) { struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); - return __alloc_page_frag(&nc->page, fragsz, gfp_mask); + return page_frag_alloc(&nc->page, fragsz, gfp_mask); } void *napi_alloc_frag(unsigned int fragsz) @@ -441,7 +441,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, local_irq_save(flags); nc = this_cpu_ptr(&netdev_alloc_cache); - data = __alloc_page_frag(nc, len, gfp_mask); + data = page_frag_alloc(nc, len, gfp_mask); pfmemalloc = nc->pfmemalloc; local_irq_restore(flags); @@ -505,7 +505,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, if (sk_memalloc_socks()) gfp_mask |= __GFP_MEMALLOC; - data = __alloc_page_frag(&nc->page, len, gfp_mask); + data = page_frag_alloc(&nc->page, len, gfp_mask); if (unlikely(!data)) return NULL; -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 507BD6B0253 for ; Tue, 29 Nov 2016 13:23:24 -0500 (EST) Received: by mail-pg0-f71.google.com with SMTP id y71so445004857pgd.0 for ; Tue, 29 Nov 2016 10:23:24 -0800 (PST) Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com. [2607:f8b0:400e:c00::243]) by mx.google.com with ESMTPS id 2si60847953pgd.31.2016.11.29.10.23.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 10:23:23 -0800 (PST) Received: by mail-pf0-x243.google.com with SMTP id i88so8724823pfk.2 for ; Tue, 29 Nov 2016 10:23:23 -0800 (PST) Subject: [mm PATCH 2/3] mm: Rename __page_frag functions to __page_frag_cache, drop order from drain From: Alexander Duyck Date: Tue, 29 Nov 2016 10:23:22 -0800 Message-ID: <20161129182322.13445.54080.stgit@localhost.localdomain> In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org From: Alexander Duyck This patch does two things. First it goes through and renames the __page_frag prefixed functions to __page_frag_cache so that we can be clear that we are draining or refilling the cache, not the frags themselves. Second we drop the order parameter from __page_frag_cache_drain since we don't actually need to pass it since all fragments are either order 0 or must be a compound page. Signed-off-by: Alexander Duyck --- drivers/net/ethernet/intel/igb/igb_main.c | 6 +++--- include/linux/gfp.h | 3 +-- mm/page_alloc.c | 13 +++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 5e66cdeb7ee3..7363503eab80 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3962,8 +3962,8 @@ static void igb_clean_rx_ring(struct igb_ring *rx_ring) PAGE_SIZE, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); - __page_frag_drain(buffer_info->page, 0, - buffer_info->pagecnt_bias); + __page_frag_cache_drain(buffer_info->page, + buffer_info->pagecnt_bias); buffer_info->page = NULL; } @@ -6987,7 +6987,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, dma_unmap_page_attrs(rx_ring->dev, rx_buffer->dma, PAGE_SIZE, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); - __page_frag_drain(page, 0, rx_buffer->pagecnt_bias); + __page_frag_cache_drain(page, rx_buffer->pagecnt_bias); } /* clear contents of rx_buffer */ diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 6238c74e0a01..884080404e24 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -506,8 +506,7 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, extern void free_hot_cold_page_list(struct list_head *list, bool cold); struct page_frag_cache; -extern void __page_frag_drain(struct page *page, unsigned int order, - unsigned int count); +extern void __page_frag_cache_drain(struct page *page, unsigned int count); extern void *page_frag_alloc(struct page_frag_cache *nc, unsigned int fragsz, gfp_t gfp_mask); extern void page_frag_free(void *addr); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4218795a4694..9559f52e740d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3896,8 +3896,8 @@ void free_pages(unsigned long addr, unsigned int order) * drivers to provide a backing region of memory for use as either an * sk_buff->head, or to be used in the "frags" portion of skb_shared_info. */ -static struct page *__page_frag_refill(struct page_frag_cache *nc, - gfp_t gfp_mask) +static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, + gfp_t gfp_mask) { struct page *page = NULL; gfp_t gfp = gfp_mask; @@ -3917,19 +3917,20 @@ static struct page *__page_frag_refill(struct page_frag_cache *nc, return page; } -void __page_frag_drain(struct page *page, unsigned int order, - unsigned int count) +void __page_frag_cache_drain(struct page *page, unsigned int count) { VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); if (page_ref_sub_and_test(page, count)) { + unsigned int order = compound_order(page); + if (order == 0) free_hot_cold_page(page, false); else __free_pages_ok(page, order); } } -EXPORT_SYMBOL(__page_frag_drain); +EXPORT_SYMBOL(__page_frag_cache_drain); void *page_frag_alloc(struct page_frag_cache *nc, unsigned int fragsz, gfp_t gfp_mask) @@ -3940,7 +3941,7 @@ void *page_frag_alloc(struct page_frag_cache *nc, if (unlikely(!nc->va)) { refill: - page = __page_frag_refill(nc, gfp_mask); + page = __page_frag_cache_refill(nc, gfp_mask); if (!page) return NULL; -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id 6A5176B0253 for ; Tue, 29 Nov 2016 13:23:30 -0500 (EST) Received: by mail-pg0-f69.google.com with SMTP id x23so450368382pgx.6 for ; Tue, 29 Nov 2016 10:23:30 -0800 (PST) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com. [2607:f8b0:400e:c05::242]) by mx.google.com with ESMTPS id b19si60997811pfc.24.2016.11.29.10.23.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 10:23:29 -0800 (PST) Received: by mail-pg0-x242.google.com with SMTP id e9so17057310pgc.1 for ; Tue, 29 Nov 2016 10:23:29 -0800 (PST) Subject: [mm PATCH 3/3] mm: Add documentation for page fragment APIs From: Alexander Duyck Date: Tue, 29 Nov 2016 10:23:28 -0800 Message-ID: <20161129182328.13445.5874.stgit@localhost.localdomain> In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org From: Alexander Duyck This is a first pass at trying to add documentation for the page_frag APIs. They may still change over time but for now I thought I would try to get these documented so that as more network drivers and stack calls make use of them we have one central spot to document how they are meant to be used. Signed-off-by: Alexander Duyck --- Documentation/vm/page_frags | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/vm/page_frags diff --git a/Documentation/vm/page_frags b/Documentation/vm/page_frags new file mode 100644 index 000000000000..a6714565dbf9 --- /dev/null +++ b/Documentation/vm/page_frags @@ -0,0 +1,42 @@ +Page fragments +-------------- + +A page fragment is an arbitrary-length arbitrary-offset area of memory +which resides within a 0 or higher order compound page. Multiple +fragments within that page are individually refcounted, in the page's +reference counter. + +The page_frag functions, page_frag_alloc and page_frag_free, provide a +simple allocation framework for page fragments. This is used by the +network stack and network device drivers to provide a backing region of +memory for use as either an sk_buff->head, or to be used in the "frags" +portion of skb_shared_info. + +In order to make use of the page fragment APIs a backing page fragment +cache is needed. This provides a central point for the fragment allocation +and tracks allows multiple calls to make use of a cached page. The +advantage to doing this is that multiple calls to get_page can be avoided +which can be expensive at allocation time. However due to the nature of +this caching it is required that any calls to the cache be protected by +either a per-cpu limitation, or a per-cpu limitation and forcing interrupts +to be disabled when executing the fragment allocation. + +The network stack uses two separate caches per CPU to handle fragment +allocation. The netdev_alloc_cache is used by callers making use of the +__netdev_alloc_frag and __netdev_alloc_skb calls. The napi_alloc_cache is +used by callers of the __napi_alloc_frag and __napi_alloc_skb calls. The +main difference between these two calls is the context in which they may be +called. The "netdev" prefixed functions are usable in any context as these +functions will disable interrupts, while the "napi" prefixed functions are +only usable within the softirq context. + +Many network device drivers use a similar methodology for allocating page +fragments, but the page fragments are cached at the ring or descriptor +level. In order to enable these cases it is necessary to provide a generic +way of tearing down a page cache. For this reason __page_frag_cache_drain +was implemented. It allows for freeing multiple references from a single +page via a single call. The advantage to doing this is that it allows for +cleaning up the multiple references that were added to a page in order to +avoid calling get_page per allocation. + +Alexander Duyck, Nov 29, 2016. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f199.google.com (mail-io0-f199.google.com [209.85.223.199]) by kanga.kvack.org (Postfix) with ESMTP id AA61C6B0038 for ; Mon, 5 Dec 2016 12:01:13 -0500 (EST) Received: by mail-io0-f199.google.com with SMTP id j65so203180350iof.1 for ; Mon, 05 Dec 2016 09:01:13 -0800 (PST) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com. [2607:f8b0:4001:c06::243]) by mx.google.com with ESMTPS id y82si11167107ioi.164.2016.12.05.09.01.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2016 09:01:12 -0800 (PST) Received: by mail-io0-x243.google.com with SMTP id h133so15613654ioe.2 for ; Mon, 05 Dec 2016 09:01:12 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> From: Alexander Duyck Date: Mon, 5 Dec 2016 09:01:12 -0800 Message-ID: Subject: Re: [mm PATCH 0/3] Page fragment updates Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm , Andrew Morton Cc: Netdev , Eric Dumazet , David Miller , Jeff Kirsher , "linux-kernel@vger.kernel.org" On Tue, Nov 29, 2016 at 10:23 AM, Alexander Duyck wrote: > This patch series takes care of a few cleanups for the page fragments API. > > First we do some renames so that things are much more consistent. First we > move the page_frag_ portion of the name to the front of the functions > names. Secondly we split out the cache specific functions from the other > page fragment functions by adding the word "cache" to the name. > > Second I did some minor clean-up on the function calls so that they are > more inline with the existing __free_pages calls in terms of how they > operate. > > Finally I added a bit of documentation that will hopefully help to explain > some of this. I plan to revisit this later as we get things more ironed > out in the near future with the changes planned for the DMA setup to > support eXpress Data Path. > > --- > > Alexander Duyck (3): > mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free > mm: Rename __page_frag functions to __page_frag_cache, drop order from drain > mm: Add documentation for page fragment APIs > > > Documentation/vm/page_frags | 42 +++++++++++++++++++++++++++++ > drivers/net/ethernet/intel/igb/igb_main.c | 6 ++-- > include/linux/gfp.h | 9 +++--- > include/linux/skbuff.h | 2 + > mm/page_alloc.c | 33 +++++++++++++---------- > net/core/skbuff.c | 8 +++--- > 6 files changed, 73 insertions(+), 27 deletions(-) > create mode 100644 Documentation/vm/page_frags > > -- It's been about a week since I submitted this series. Just wanted to check in and see if anyone had any feedback or if this is good to be accepted for 4.10-rc1 with the rest of the set? Thanks. - 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id E97456B0038 for ; Mon, 5 Dec 2016 15:11:06 -0500 (EST) Received: by mail-pf0-f198.google.com with SMTP id j128so523309524pfg.4 for ; Mon, 05 Dec 2016 12:11:06 -0800 (PST) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id a1si15839831pld.31.2016.12.05.12.11.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2016 12:11:06 -0800 (PST) Date: Mon, 5 Dec 2016 12:11:31 -0800 From: Andrew Morton Subject: Re: [mm PATCH 0/3] Page fragment updates Message-Id: <20161205121131.3c1d9ad8452d5e09247336e4@linux-foundation.org> In-Reply-To: References: <20161129182010.13445.31256.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Alexander Duyck Cc: linux-mm , Netdev , Eric Dumazet , David Miller , Jeff Kirsher , "linux-kernel@vger.kernel.org" On Mon, 5 Dec 2016 09:01:12 -0800 Alexander Duyck wrote: > On Tue, Nov 29, 2016 at 10:23 AM, Alexander Duyck > wrote: > > This patch series takes care of a few cleanups for the page fragments API. > > > > ... > > It's been about a week since I submitted this series. Just wanted to > check in and see if anyone had any feedback or if this is good to be > accepted for 4.10-rc1 with the rest of the set? Looks good to me. I have it all queued for post-4.9 processing. -- 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f69.google.com (mail-it0-f69.google.com [209.85.214.69]) by kanga.kvack.org (Postfix) with ESMTP id 418296B034D for ; Tue, 20 Dec 2016 14:22:36 -0500 (EST) Received: by mail-it0-f69.google.com with SMTP id n68so116870917itn.4 for ; Tue, 20 Dec 2016 11:22:36 -0800 (PST) Received: from mail-io0-x241.google.com (mail-io0-x241.google.com. [2607:f8b0:4001:c06::241]) by mx.google.com with ESMTPS id v64si14250547itd.3.2016.12.20.11.22.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 11:22:35 -0800 (PST) Received: by mail-io0-x241.google.com with SMTP id p13so23503024ioi.0 for ; Tue, 20 Dec 2016 11:22:35 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20161205121131.3c1d9ad8452d5e09247336e4@linux-foundation.org> References: <20161129182010.13445.31256.stgit@localhost.localdomain> <20161205121131.3c1d9ad8452d5e09247336e4@linux-foundation.org> From: Alexander Duyck Date: Tue, 20 Dec 2016 11:22:34 -0800 Message-ID: Subject: Re: [mm PATCH 0/3] Page fragment updates Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: linux-mm , Netdev , Eric Dumazet , David Miller , Jeff Kirsher , "linux-kernel@vger.kernel.org" On Mon, Dec 5, 2016 at 12:11 PM, Andrew Morton wrote: > On Mon, 5 Dec 2016 09:01:12 -0800 Alexander Duyck wrote: > >> On Tue, Nov 29, 2016 at 10:23 AM, Alexander Duyck >> wrote: >> > This patch series takes care of a few cleanups for the page fragments API. >> > >> > ... >> >> It's been about a week since I submitted this series. Just wanted to >> check in and see if anyone had any feedback or if this is good to be >> accepted for 4.10-rc1 with the rest of the set? > > Looks good to me. I have it all queued for post-4.9 processing. So I guess there is a small bug in the first patch in that I was comparing a pointer to to 0 instead of NULL. Just wondering if I should resubmit the first patch, the whole series, or if I need to just submit an incremental patch. Thanks. - 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933969AbcK2SXU (ORCPT ); Tue, 29 Nov 2016 13:23:20 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35349 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751732AbcK2SXK (ORCPT ); Tue, 29 Nov 2016 13:23:10 -0500 Subject: [mm PATCH 0/3] Page fragment updates From: Alexander Duyck To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org Date: Tue, 29 Nov 2016 10:23:08 -0800 Message-ID: <20161129182010.13445.31256.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series takes care of a few cleanups for the page fragments API. First we do some renames so that things are much more consistent. First we move the page_frag_ portion of the name to the front of the functions names. Secondly we split out the cache specific functions from the other page fragment functions by adding the word "cache" to the name. Second I did some minor clean-up on the function calls so that they are more inline with the existing __free_pages calls in terms of how they operate. Finally I added a bit of documentation that will hopefully help to explain some of this. I plan to revisit this later as we get things more ironed out in the near future with the changes planned for the DMA setup to support eXpress Data Path. --- Alexander Duyck (3): mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free mm: Rename __page_frag functions to __page_frag_cache, drop order from drain mm: Add documentation for page fragment APIs Documentation/vm/page_frags | 42 +++++++++++++++++++++++++++++ drivers/net/ethernet/intel/igb/igb_main.c | 6 ++-- include/linux/gfp.h | 9 +++--- include/linux/skbuff.h | 2 + mm/page_alloc.c | 33 +++++++++++++---------- net/core/skbuff.c | 8 +++--- 6 files changed, 73 insertions(+), 27 deletions(-) create mode 100644 Documentation/vm/page_frags -- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934105AbcK2SXp (ORCPT ); Tue, 29 Nov 2016 13:23:45 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36295 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933960AbcK2SXS (ORCPT ); Tue, 29 Nov 2016 13:23:18 -0500 Subject: [mm PATCH 1/3] mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free From: Alexander Duyck To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org Date: Tue, 29 Nov 2016 10:23:15 -0800 Message-ID: <20161129182315.13445.17597.stgit@localhost.localdomain> In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Duyck This patch renames the page frag functions to be more consistent with other APIs. Specifically we place the name page_frag first in the name and then have either an alloc or free call name that we append as the suffix. This makes it a bit clearer in terms of naming. In addition we drop the leading double underscores since we are technically no longer a backing interface and instead the front end that is called from the networking APIs. The last bit I changed is I rebased page_frag_free to actually function very similar to the function free_pages, the only real difference now is the fact that we have to get the page order by calling compound page instead of having it passed as a part of the function call. Signed-off-by: Alexander Duyck --- include/linux/gfp.h | 6 +++--- include/linux/skbuff.h | 2 +- mm/page_alloc.c | 20 ++++++++++++-------- net/core/skbuff.c | 8 ++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 4175dca4ac39..6238c74e0a01 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -508,9 +508,9 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, struct page_frag_cache; extern void __page_frag_drain(struct page *page, unsigned int order, unsigned int count); -extern void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask); -extern void __free_page_frag(void *addr); +extern void *page_frag_alloc(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask); +extern void page_frag_free(void *addr); #define __free_page(page) __free_pages((page), 0) #define free_page(addr) free_pages((addr), 0) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9c535fbccf2c..95799826a1e7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2471,7 +2471,7 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, static inline void skb_free_frag(void *addr) { - __free_page_frag(addr); + page_frag_free(addr); } void *napi_alloc_frag(unsigned int fragsz); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bb668eab5ee4..4218795a4694 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3931,8 +3931,8 @@ void __page_frag_drain(struct page *page, unsigned int order, } EXPORT_SYMBOL(__page_frag_drain); -void *__alloc_page_frag(struct page_frag_cache *nc, - unsigned int fragsz, gfp_t gfp_mask) +void *page_frag_alloc(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask) { unsigned int size = PAGE_SIZE; struct page *page; @@ -3983,19 +3983,23 @@ void *__alloc_page_frag(struct page_frag_cache *nc, return nc->va + offset; } -EXPORT_SYMBOL(__alloc_page_frag); +EXPORT_SYMBOL(page_frag_alloc); /* * Frees a page fragment allocated out of either a compound or order 0 page. */ -void __free_page_frag(void *addr) +void page_frag_free(void *addr) { - struct page *page = virt_to_head_page(addr); + struct page *page; + + if (addr != 0) { + VM_BUG_ON(!virt_addr_valid(addr)); + page = virt_to_head_page(addr); - if (unlikely(put_page_testzero(page))) - __free_pages_ok(page, compound_order(page)); + __free_pages(page, compound_order(page)); + } } -EXPORT_SYMBOL(__free_page_frag); +EXPORT_SYMBOL(page_frag_free); static void *make_alloc_exact(unsigned long addr, unsigned int order, size_t size) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4c96cb18c214..6cf779a9ad4c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -369,7 +369,7 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) local_irq_save(flags); nc = this_cpu_ptr(&netdev_alloc_cache); - data = __alloc_page_frag(nc, fragsz, gfp_mask); + data = page_frag_alloc(nc, fragsz, gfp_mask); local_irq_restore(flags); return data; } @@ -391,7 +391,7 @@ static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) { struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); - return __alloc_page_frag(&nc->page, fragsz, gfp_mask); + return page_frag_alloc(&nc->page, fragsz, gfp_mask); } void *napi_alloc_frag(unsigned int fragsz) @@ -441,7 +441,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, local_irq_save(flags); nc = this_cpu_ptr(&netdev_alloc_cache); - data = __alloc_page_frag(nc, len, gfp_mask); + data = page_frag_alloc(nc, len, gfp_mask); pfmemalloc = nc->pfmemalloc; local_irq_restore(flags); @@ -505,7 +505,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, if (sk_memalloc_socks()) gfp_mask |= __GFP_MEMALLOC; - data = __alloc_page_frag(&nc->page, len, gfp_mask); + data = page_frag_alloc(&nc->page, len, gfp_mask); if (unlikely(!data)) return NULL; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754314AbcK2SX4 (ORCPT ); Tue, 29 Nov 2016 13:23:56 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:32888 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751732AbcK2SXY (ORCPT ); Tue, 29 Nov 2016 13:23:24 -0500 Subject: [mm PATCH 2/3] mm: Rename __page_frag functions to __page_frag_cache, drop order from drain From: Alexander Duyck To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org Date: Tue, 29 Nov 2016 10:23:22 -0800 Message-ID: <20161129182322.13445.54080.stgit@localhost.localdomain> In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Duyck This patch does two things. First it goes through and renames the __page_frag prefixed functions to __page_frag_cache so that we can be clear that we are draining or refilling the cache, not the frags themselves. Second we drop the order parameter from __page_frag_cache_drain since we don't actually need to pass it since all fragments are either order 0 or must be a compound page. Signed-off-by: Alexander Duyck --- drivers/net/ethernet/intel/igb/igb_main.c | 6 +++--- include/linux/gfp.h | 3 +-- mm/page_alloc.c | 13 +++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 5e66cdeb7ee3..7363503eab80 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3962,8 +3962,8 @@ static void igb_clean_rx_ring(struct igb_ring *rx_ring) PAGE_SIZE, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); - __page_frag_drain(buffer_info->page, 0, - buffer_info->pagecnt_bias); + __page_frag_cache_drain(buffer_info->page, + buffer_info->pagecnt_bias); buffer_info->page = NULL; } @@ -6987,7 +6987,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring, dma_unmap_page_attrs(rx_ring->dev, rx_buffer->dma, PAGE_SIZE, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); - __page_frag_drain(page, 0, rx_buffer->pagecnt_bias); + __page_frag_cache_drain(page, rx_buffer->pagecnt_bias); } /* clear contents of rx_buffer */ diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 6238c74e0a01..884080404e24 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -506,8 +506,7 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, extern void free_hot_cold_page_list(struct list_head *list, bool cold); struct page_frag_cache; -extern void __page_frag_drain(struct page *page, unsigned int order, - unsigned int count); +extern void __page_frag_cache_drain(struct page *page, unsigned int count); extern void *page_frag_alloc(struct page_frag_cache *nc, unsigned int fragsz, gfp_t gfp_mask); extern void page_frag_free(void *addr); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4218795a4694..9559f52e740d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3896,8 +3896,8 @@ void free_pages(unsigned long addr, unsigned int order) * drivers to provide a backing region of memory for use as either an * sk_buff->head, or to be used in the "frags" portion of skb_shared_info. */ -static struct page *__page_frag_refill(struct page_frag_cache *nc, - gfp_t gfp_mask) +static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, + gfp_t gfp_mask) { struct page *page = NULL; gfp_t gfp = gfp_mask; @@ -3917,19 +3917,20 @@ static struct page *__page_frag_refill(struct page_frag_cache *nc, return page; } -void __page_frag_drain(struct page *page, unsigned int order, - unsigned int count) +void __page_frag_cache_drain(struct page *page, unsigned int count) { VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); if (page_ref_sub_and_test(page, count)) { + unsigned int order = compound_order(page); + if (order == 0) free_hot_cold_page(page, false); else __free_pages_ok(page, order); } } -EXPORT_SYMBOL(__page_frag_drain); +EXPORT_SYMBOL(__page_frag_cache_drain); void *page_frag_alloc(struct page_frag_cache *nc, unsigned int fragsz, gfp_t gfp_mask) @@ -3940,7 +3941,7 @@ void *page_frag_alloc(struct page_frag_cache *nc, if (unlikely(!nc->va)) { refill: - page = __page_frag_refill(nc, gfp_mask); + page = __page_frag_cache_refill(nc, gfp_mask); if (!page) return NULL; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934179AbcK2SYS (ORCPT ); Tue, 29 Nov 2016 13:24:18 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36483 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934029AbcK2SXa (ORCPT ); Tue, 29 Nov 2016 13:23:30 -0500 Subject: [mm PATCH 3/3] mm: Add documentation for page fragment APIs From: Alexander Duyck To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, edumazet@google.com, davem@davemloft.net, jeffrey.t.kirsher@intel.com, linux-kernel@vger.kernel.org Date: Tue, 29 Nov 2016 10:23:28 -0800 Message-ID: <20161129182328.13445.5874.stgit@localhost.localdomain> In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Duyck This is a first pass at trying to add documentation for the page_frag APIs. They may still change over time but for now I thought I would try to get these documented so that as more network drivers and stack calls make use of them we have one central spot to document how they are meant to be used. Signed-off-by: Alexander Duyck --- Documentation/vm/page_frags | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/vm/page_frags diff --git a/Documentation/vm/page_frags b/Documentation/vm/page_frags new file mode 100644 index 000000000000..a6714565dbf9 --- /dev/null +++ b/Documentation/vm/page_frags @@ -0,0 +1,42 @@ +Page fragments +-------------- + +A page fragment is an arbitrary-length arbitrary-offset area of memory +which resides within a 0 or higher order compound page. Multiple +fragments within that page are individually refcounted, in the page's +reference counter. + +The page_frag functions, page_frag_alloc and page_frag_free, provide a +simple allocation framework for page fragments. This is used by the +network stack and network device drivers to provide a backing region of +memory for use as either an sk_buff->head, or to be used in the "frags" +portion of skb_shared_info. + +In order to make use of the page fragment APIs a backing page fragment +cache is needed. This provides a central point for the fragment allocation +and tracks allows multiple calls to make use of a cached page. The +advantage to doing this is that multiple calls to get_page can be avoided +which can be expensive at allocation time. However due to the nature of +this caching it is required that any calls to the cache be protected by +either a per-cpu limitation, or a per-cpu limitation and forcing interrupts +to be disabled when executing the fragment allocation. + +The network stack uses two separate caches per CPU to handle fragment +allocation. The netdev_alloc_cache is used by callers making use of the +__netdev_alloc_frag and __netdev_alloc_skb calls. The napi_alloc_cache is +used by callers of the __napi_alloc_frag and __napi_alloc_skb calls. The +main difference between these two calls is the context in which they may be +called. The "netdev" prefixed functions are usable in any context as these +functions will disable interrupts, while the "napi" prefixed functions are +only usable within the softirq context. + +Many network device drivers use a similar methodology for allocating page +fragments, but the page fragments are cached at the ring or descriptor +level. In order to enable these cases it is necessary to provide a generic +way of tearing down a page cache. For this reason __page_frag_cache_drain +was implemented. It allows for freeing multiple references from a single +page via a single call. The advantage to doing this is that it allows for +cleaning up the multiple references that were added to a page in order to +avoid calling get_page per allocation. + +Alexander Duyck, Nov 29, 2016. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751932AbcLERBQ (ORCPT ); Mon, 5 Dec 2016 12:01:16 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:33416 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbcLERBN (ORCPT ); Mon, 5 Dec 2016 12:01:13 -0500 MIME-Version: 1.0 In-Reply-To: <20161129182010.13445.31256.stgit@localhost.localdomain> References: <20161129182010.13445.31256.stgit@localhost.localdomain> From: Alexander Duyck Date: Mon, 5 Dec 2016 09:01:12 -0800 Message-ID: Subject: Re: [mm PATCH 0/3] Page fragment updates To: linux-mm , Andrew Morton Cc: Netdev , Eric Dumazet , David Miller , Jeff Kirsher , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2016 at 10:23 AM, Alexander Duyck wrote: > This patch series takes care of a few cleanups for the page fragments API. > > First we do some renames so that things are much more consistent. First we > move the page_frag_ portion of the name to the front of the functions > names. Secondly we split out the cache specific functions from the other > page fragment functions by adding the word "cache" to the name. > > Second I did some minor clean-up on the function calls so that they are > more inline with the existing __free_pages calls in terms of how they > operate. > > Finally I added a bit of documentation that will hopefully help to explain > some of this. I plan to revisit this later as we get things more ironed > out in the near future with the changes planned for the DMA setup to > support eXpress Data Path. > > --- > > Alexander Duyck (3): > mm: Rename __alloc_page_frag to page_frag_alloc and __free_page_frag to page_frag_free > mm: Rename __page_frag functions to __page_frag_cache, drop order from drain > mm: Add documentation for page fragment APIs > > > Documentation/vm/page_frags | 42 +++++++++++++++++++++++++++++ > drivers/net/ethernet/intel/igb/igb_main.c | 6 ++-- > include/linux/gfp.h | 9 +++--- > include/linux/skbuff.h | 2 + > mm/page_alloc.c | 33 +++++++++++++---------- > net/core/skbuff.c | 8 +++--- > 6 files changed, 73 insertions(+), 27 deletions(-) > create mode 100644 Documentation/vm/page_frags > > -- It's been about a week since I submitted this series. Just wanted to check in and see if anyone had any feedback or if this is good to be accepted for 4.10-rc1 with the rest of the set? Thanks. - Alex From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752802AbcLEULJ (ORCPT ); Mon, 5 Dec 2016 15:11:09 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41476 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbcLEULG (ORCPT ); Mon, 5 Dec 2016 15:11:06 -0500 Date: Mon, 5 Dec 2016 12:11:31 -0800 From: Andrew Morton To: Alexander Duyck Cc: linux-mm , Netdev , Eric Dumazet , David Miller , Jeff Kirsher , "linux-kernel@vger.kernel.org" Subject: Re: [mm PATCH 0/3] Page fragment updates Message-Id: <20161205121131.3c1d9ad8452d5e09247336e4@linux-foundation.org> In-Reply-To: References: <20161129182010.13445.31256.stgit@localhost.localdomain> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 5 Dec 2016 09:01:12 -0800 Alexander Duyck wrote: > On Tue, Nov 29, 2016 at 10:23 AM, Alexander Duyck > wrote: > > This patch series takes care of a few cleanups for the page fragments API. > > > > ... > > It's been about a week since I submitted this series. Just wanted to > check in and see if anyone had any feedback or if this is good to be > accepted for 4.10-rc1 with the rest of the set? Looks good to me. I have it all queued for post-4.9 processing. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965451AbcLTT0y (ORCPT ); Tue, 20 Dec 2016 14:26:54 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:33600 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965055AbcLTTWg (ORCPT ); Tue, 20 Dec 2016 14:22:36 -0500 MIME-Version: 1.0 In-Reply-To: <20161205121131.3c1d9ad8452d5e09247336e4@linux-foundation.org> References: <20161129182010.13445.31256.stgit@localhost.localdomain> <20161205121131.3c1d9ad8452d5e09247336e4@linux-foundation.org> From: Alexander Duyck Date: Tue, 20 Dec 2016 11:22:34 -0800 Message-ID: Subject: Re: [mm PATCH 0/3] Page fragment updates To: Andrew Morton Cc: linux-mm , Netdev , Eric Dumazet , David Miller , Jeff Kirsher , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 5, 2016 at 12:11 PM, Andrew Morton wrote: > On Mon, 5 Dec 2016 09:01:12 -0800 Alexander Duyck wrote: > >> On Tue, Nov 29, 2016 at 10:23 AM, Alexander Duyck >> wrote: >> > This patch series takes care of a few cleanups for the page fragments API. >> > >> > ... >> >> It's been about a week since I submitted this series. Just wanted to >> check in and see if anyone had any feedback or if this is good to be >> accepted for 4.10-rc1 with the rest of the set? > > Looks good to me. I have it all queued for post-4.9 processing. So I guess there is a small bug in the first patch in that I was comparing a pointer to to 0 instead of NULL. Just wondering if I should resubmit the first patch, the whole series, or if I need to just submit an incremental patch. Thanks. - Alex