Re: [PATCH] amd-xgbe: use PAGE_ALLOC_COSTLY_ORDER in xgbe_map_rx_buffer

2017-06-04 Thread David Miller
From: Michal Hocko 
Date: Fri,  2 Jun 2017 17:54:08 +0200

> From: Michal Hocko 
> 
> xgbe_map_rx_buffer is rather confused about what PAGE_ALLOC_COSTLY_ORDER
> means. It uses PAGE_ALLOC_COSTLY_ORDER-1 assuming that
> PAGE_ALLOC_COSTLY_ORDER is the first costly order which is not the case
> actually because orders larger than that are costly. And even that
> applies only to sleeping allocations which is not the case here. We
> simply do not perform any costly operations like reclaim or compaction
> for those. Simplify the code by dropping the order calculation and use
> PAGE_ALLOC_COSTLY_ORDER directly.
> 
> Signed-off-by: Michal Hocko 

Applied.


Re: [PATCH] amd-xgbe: use PAGE_ALLOC_COSTLY_ORDER in xgbe_map_rx_buffer

2017-06-04 Thread David Miller
From: Michal Hocko 
Date: Fri,  2 Jun 2017 17:54:08 +0200

> From: Michal Hocko 
> 
> xgbe_map_rx_buffer is rather confused about what PAGE_ALLOC_COSTLY_ORDER
> means. It uses PAGE_ALLOC_COSTLY_ORDER-1 assuming that
> PAGE_ALLOC_COSTLY_ORDER is the first costly order which is not the case
> actually because orders larger than that are costly. And even that
> applies only to sleeping allocations which is not the case here. We
> simply do not perform any costly operations like reclaim or compaction
> for those. Simplify the code by dropping the order calculation and use
> PAGE_ALLOC_COSTLY_ORDER directly.
> 
> Signed-off-by: Michal Hocko 

Applied.


Re: [PATCH] amd-xgbe: use PAGE_ALLOC_COSTLY_ORDER in xgbe_map_rx_buffer

2017-06-02 Thread kbuild test robot
Hi Michal,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.12-rc3 next-20170602]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Michal-Hocko/amd-xgbe-use-PAGE_ALLOC_COSTLY_ORDER-in-xgbe_map_rx_buffer/20170603-021038
config: x86_64-randconfig-v0-06030836 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net//ethernet/amd/xgbe/xgbe-desc.c: In function 'xgbe_map_rx_buffer':
>> drivers/net//ethernet/amd/xgbe/xgbe-desc.c:327: warning: unused variable 
>> 'order'

vim +/order +327 drivers/net//ethernet/amd/xgbe/xgbe-desc.c

174fd259 Lendacky, Thomas 2014-11-04  311   if ((pa->pages_offset + len) > 
pa->pages_len) {
08dcc47c Lendacky, Thomas 2014-11-04  312   /* This data descriptor 
is responsible for unmapping page(s) */
174fd259 Lendacky, Thomas 2014-11-04  313   bd->pa_unmap = *pa;
08dcc47c Lendacky, Thomas 2014-11-04  314  
08dcc47c Lendacky, Thomas 2014-11-04  315   /* Get a new allocation 
next time */
174fd259 Lendacky, Thomas 2014-11-04  316   pa->pages = NULL;
174fd259 Lendacky, Thomas 2014-11-04  317   pa->pages_len = 0;
174fd259 Lendacky, Thomas 2014-11-04  318   pa->pages_offset = 0;
174fd259 Lendacky, Thomas 2014-11-04  319   pa->pages_dma = 0;
174fd259 Lendacky, Thomas 2014-11-04  320   }
174fd259 Lendacky, Thomas 2014-11-04  321  }
174fd259 Lendacky, Thomas 2014-11-04  322  
174fd259 Lendacky, Thomas 2014-11-04  323  static int xgbe_map_rx_buffer(struct 
xgbe_prv_data *pdata,
174fd259 Lendacky, Thomas 2014-11-04  324 struct 
xgbe_ring *ring,
174fd259 Lendacky, Thomas 2014-11-04  325 struct 
xgbe_ring_data *rdata)
174fd259 Lendacky, Thomas 2014-11-04  326  {
174fd259 Lendacky, Thomas 2014-11-04 @327   int order, ret;
174fd259 Lendacky, Thomas 2014-11-04  328  
174fd259 Lendacky, Thomas 2014-11-04  329   if (!ring->rx_hdr_pa.pages) {
174fd259 Lendacky, Thomas 2014-11-04  330   ret = 
xgbe_alloc_pages(pdata, >rx_hdr_pa, GFP_ATOMIC, 0);
174fd259 Lendacky, Thomas 2014-11-04  331   if (ret)
174fd259 Lendacky, Thomas 2014-11-04  332   return ret;
08dcc47c Lendacky, Thomas 2014-11-04  333   }
08dcc47c Lendacky, Thomas 2014-11-04  334  
174fd259 Lendacky, Thomas 2014-11-04  335   if (!ring->rx_buf_pa.pages) {

:: The code at line 327 was first introduced by commit
:: 174fd2597b0bd8c19fce6a97e8b0f753ef4ce7cb amd-xgbe: Implement split 
header receive support

:: TO: Lendacky, Thomas 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] amd-xgbe: use PAGE_ALLOC_COSTLY_ORDER in xgbe_map_rx_buffer

2017-06-02 Thread kbuild test robot
Hi Michal,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.12-rc3 next-20170602]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Michal-Hocko/amd-xgbe-use-PAGE_ALLOC_COSTLY_ORDER-in-xgbe_map_rx_buffer/20170603-021038
config: x86_64-randconfig-v0-06030836 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net//ethernet/amd/xgbe/xgbe-desc.c: In function 'xgbe_map_rx_buffer':
>> drivers/net//ethernet/amd/xgbe/xgbe-desc.c:327: warning: unused variable 
>> 'order'

vim +/order +327 drivers/net//ethernet/amd/xgbe/xgbe-desc.c

174fd259 Lendacky, Thomas 2014-11-04  311   if ((pa->pages_offset + len) > 
pa->pages_len) {
08dcc47c Lendacky, Thomas 2014-11-04  312   /* This data descriptor 
is responsible for unmapping page(s) */
174fd259 Lendacky, Thomas 2014-11-04  313   bd->pa_unmap = *pa;
08dcc47c Lendacky, Thomas 2014-11-04  314  
08dcc47c Lendacky, Thomas 2014-11-04  315   /* Get a new allocation 
next time */
174fd259 Lendacky, Thomas 2014-11-04  316   pa->pages = NULL;
174fd259 Lendacky, Thomas 2014-11-04  317   pa->pages_len = 0;
174fd259 Lendacky, Thomas 2014-11-04  318   pa->pages_offset = 0;
174fd259 Lendacky, Thomas 2014-11-04  319   pa->pages_dma = 0;
174fd259 Lendacky, Thomas 2014-11-04  320   }
174fd259 Lendacky, Thomas 2014-11-04  321  }
174fd259 Lendacky, Thomas 2014-11-04  322  
174fd259 Lendacky, Thomas 2014-11-04  323  static int xgbe_map_rx_buffer(struct 
xgbe_prv_data *pdata,
174fd259 Lendacky, Thomas 2014-11-04  324 struct 
xgbe_ring *ring,
174fd259 Lendacky, Thomas 2014-11-04  325 struct 
xgbe_ring_data *rdata)
174fd259 Lendacky, Thomas 2014-11-04  326  {
174fd259 Lendacky, Thomas 2014-11-04 @327   int order, ret;
174fd259 Lendacky, Thomas 2014-11-04  328  
174fd259 Lendacky, Thomas 2014-11-04  329   if (!ring->rx_hdr_pa.pages) {
174fd259 Lendacky, Thomas 2014-11-04  330   ret = 
xgbe_alloc_pages(pdata, >rx_hdr_pa, GFP_ATOMIC, 0);
174fd259 Lendacky, Thomas 2014-11-04  331   if (ret)
174fd259 Lendacky, Thomas 2014-11-04  332   return ret;
08dcc47c Lendacky, Thomas 2014-11-04  333   }
08dcc47c Lendacky, Thomas 2014-11-04  334  
174fd259 Lendacky, Thomas 2014-11-04  335   if (!ring->rx_buf_pa.pages) {

:: The code at line 327 was first introduced by commit
:: 174fd2597b0bd8c19fce6a97e8b0f753ef4ce7cb amd-xgbe: Implement split 
header receive support

:: TO: Lendacky, Thomas 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] amd-xgbe: use PAGE_ALLOC_COSTLY_ORDER in xgbe_map_rx_buffer

2017-06-02 Thread Tom Lendacky

On 6/2/2017 10:54 AM, Michal Hocko wrote:

From: Michal Hocko 

xgbe_map_rx_buffer is rather confused about what PAGE_ALLOC_COSTLY_ORDER
means. It uses PAGE_ALLOC_COSTLY_ORDER-1 assuming that
PAGE_ALLOC_COSTLY_ORDER is the first costly order which is not the case
actually because orders larger than that are costly. And even that
applies only to sleeping allocations which is not the case here. We
simply do not perform any costly operations like reclaim or compaction
for those. Simplify the code by dropping the order calculation and use
PAGE_ALLOC_COSTLY_ORDER directly.

Signed-off-by: Michal Hocko 


Acked-by: Tom Lendacky 


---
  drivers/net/ethernet/amd/xgbe/xgbe-desc.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c 
b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
index b3bc87fe3764..0a98c369df20 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
@@ -324,7 +324,7 @@ static int xgbe_map_rx_buffer(struct xgbe_prv_data *pdata,
  struct xgbe_ring *ring,
  struct xgbe_ring_data *rdata)
  {
-   int order, ret;
+   int ret;
  
  	if (!ring->rx_hdr_pa.pages) {

ret = xgbe_alloc_pages(pdata, >rx_hdr_pa, GFP_ATOMIC, 0);
@@ -333,9 +333,8 @@ static int xgbe_map_rx_buffer(struct xgbe_prv_data *pdata,
}
  
  	if (!ring->rx_buf_pa.pages) {

-   order = max_t(int, PAGE_ALLOC_COSTLY_ORDER - 1, 0);
ret = xgbe_alloc_pages(pdata, >rx_buf_pa, GFP_ATOMIC,
-  order);
+  PAGE_ALLOC_COSTLY_ORDER);
if (ret)
return ret;
}



Re: [PATCH] amd-xgbe: use PAGE_ALLOC_COSTLY_ORDER in xgbe_map_rx_buffer

2017-06-02 Thread Tom Lendacky

On 6/2/2017 10:54 AM, Michal Hocko wrote:

From: Michal Hocko 

xgbe_map_rx_buffer is rather confused about what PAGE_ALLOC_COSTLY_ORDER
means. It uses PAGE_ALLOC_COSTLY_ORDER-1 assuming that
PAGE_ALLOC_COSTLY_ORDER is the first costly order which is not the case
actually because orders larger than that are costly. And even that
applies only to sleeping allocations which is not the case here. We
simply do not perform any costly operations like reclaim or compaction
for those. Simplify the code by dropping the order calculation and use
PAGE_ALLOC_COSTLY_ORDER directly.

Signed-off-by: Michal Hocko 


Acked-by: Tom Lendacky 


---
  drivers/net/ethernet/amd/xgbe/xgbe-desc.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c 
b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
index b3bc87fe3764..0a98c369df20 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
@@ -324,7 +324,7 @@ static int xgbe_map_rx_buffer(struct xgbe_prv_data *pdata,
  struct xgbe_ring *ring,
  struct xgbe_ring_data *rdata)
  {
-   int order, ret;
+   int ret;
  
  	if (!ring->rx_hdr_pa.pages) {

ret = xgbe_alloc_pages(pdata, >rx_hdr_pa, GFP_ATOMIC, 0);
@@ -333,9 +333,8 @@ static int xgbe_map_rx_buffer(struct xgbe_prv_data *pdata,
}
  
  	if (!ring->rx_buf_pa.pages) {

-   order = max_t(int, PAGE_ALLOC_COSTLY_ORDER - 1, 0);
ret = xgbe_alloc_pages(pdata, >rx_buf_pa, GFP_ATOMIC,
-  order);
+  PAGE_ALLOC_COSTLY_ORDER);
if (ret)
return ret;
}