Skip to contentSkip to conversation

net: more accurate skb truesize - regression on Microblaze

PATCH Superseded Michal Simek 4 participants 28 messages Apr 10, 2012 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Eric,

I have spent some time to investigate what it is causing regression on our network bechmark and I have identified that your patch "net: more accurate skb truesize" is causing that.

I see regression especially on incoming tcp (RX) connection which is 20%. On TX I see regression till 5%.

In general microblaze systems are pretty sensitive for memory usage and working with it. Increasing packet sizes has big impact on performance.
I was surprised that regression is so high.

From microblaze point of view is more important to remove that performance regression than having more accurate memory accounting. 20% performance regression is simple so high for that.
Isn't there any other way to doing better memory accounting?
Or is there any workaround which would be possible to use?

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#1 lore raw
Quoted 11 lines · Michal Simek

Hi Eric,

I have spent some time to investigate what it is causing regression on our network bechmark and I have identified that your patch "net: more accurate skb truesize" is causing that.

I see regression especially on incoming tcp (RX) connection which is 20%. On TX I see regression till 5%.

In general microblaze systems are pretty sensitive for memory usage and working with it. Increasing packet sizes has big impact on performance.
I was surprised that regression is so high.

Quoted 9 lines

From microblaze point of view is more important to remove that performance regression
than having more accurate memory accounting. 20% performance regression is simple so high for that.
Isn't there any other way to doing better memory accounting?
Or is there any workaround which would be possible to use?

Thanks,
Michal

Hi Michal

We are currently working on the issue.

TCP stack was a bit optimistic in the ideal skb->len / skb->truesize ratio that happened to 'mostly work' before my patch, but not anymore after it.

memory accounting was wrong, we really wanted to be accurate, or risk OOM and crashes.

Now we must fix tcp.

In the meantime you could try :

echo 1 >/proc/sys/net/ipv4/tcp_adv_win_scale

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

#2 lore raw
Quoted 5 lines · Eric Dumazet

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

What is the driver you currently use on your platform ?

#3 lore raw
Quoted 9 lines · Eric Dumazet
Quoted 5 lines · Eric Dumazet

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

What is the driver you currently use on your platform ?

Using Xilinx ll_temac(in mainline) and axi_emac.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#4 lore raw
Quoted 9 lines · Michal Simek
Quoted 8 lines · Eric Dumazet
Quoted 5 lines · Eric Dumazet

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

Quoted 4 lines
Quoted 1 line

What is the driver you currently use on your platform ?

Using Xilinx ll_temac(in mainline) and axi_emac.

OK thanks, could you please give us the content
of /proc/sys/net/ipv4/tcp_rmem ?

#5 lore raw
Quoted 10 lines · Eric Dumazet
Quoted 9 lines · Michal Simek
Quoted 8 lines · Eric Dumazet
Quoted 5 lines · Eric Dumazet

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

What is the driver you currently use on your platform ?

Using Xilinx ll_temac(in mainline) and axi_emac.

OK thanks, could you please give us the content
of /proc/sys/net/ipv4/tcp_rmem ?

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Let me know if you want to test anything.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#6 lore raw
Quoted 2 lines · Michal Simek

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Are they default values, or tuned by admin ?

130048 bytes isnt enough to let TCP open its rcv window.

#7 lore raw
Quoted 8 lines · Eric Dumazet
Quoted 2 lines · Michal Simek

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Are they default values, or tuned by admin ?

130048 bytes isnt enough to let TCP open its rcv window.

yep. Default value after powerup. What's wrong with that?

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#8 lore raw
Quoted 6 lines · Michal Simek
Quoted 5 lines · Eric Dumazet
Quoted 2 lines · Michal Simek

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Quoted 8 lines
Quoted 3 lines

Are they default values, or tuned by admin ?

130048 bytes isnt enough to let TCP open its rcv window.

yep. Default value after powerup. What's wrong with that?

Michal

I guess your tcp performance is driven by these numbers mostly.

receive window wont grow above 64K in these case. a tcpdump could confirm the issue.

Do you have 130000 pages of memory ?

Seems the net/ipv4/tcp.c code is wrong (or the comment is wrong)

Since its not 1/128 but 1/1024 ....

        /* Set per-socket limits to no more than 1/128 the pressure threshold */
        limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);
        limit = max(limit, 128UL);
        max_share = min(4UL*1024*1024, limit);

        sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
        sysctl_tcp_wmem[1] = 16*1024;
        sysctl_tcp_wmem[2] = max(64*1024, max_share);

        sysctl_tcp_rmem[0] = SK_MEM_QUANTUM;
        sysctl_tcp_rmem[1] = 87380;
        sysctl_tcp_rmem[2] = max(87380, max_share);
#9 lore raw
Quoted 16 lines · Eric Dumazet
Quoted 6 lines · Michal Simek
Quoted 5 lines · Eric Dumazet
Quoted 2 lines · Michal Simek

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Quoted 8 lines
Quoted 3 lines

Are they default values, or tuned by admin ?

130048 bytes isnt enough to let TCP open its rcv window.

yep. Default value after powerup. What's wrong with that?

Michal

Quoted 6 lines

I guess your tcp performance is driven by these numbers mostly.

receive window wont grow above 64K in these case. a tcpdump could confirm the issue.

Do you have 130000 pages of memory ?

128MB memory and 4k page which is 32k pages.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#10 lore raw
In reply to Eric Dumazet
Quoted 28 lines · Eric Dumazet
Quoted 6 lines · Michal Simek
Quoted 5 lines · Eric Dumazet
Quoted 2 lines · Michal Simek

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Quoted 8 lines
Quoted 3 lines

Are they default values, or tuned by admin ?

130048 bytes isnt enough to let TCP open its rcv window.

yep. Default value after powerup. What's wrong with that?

Michal

I guess your tcp performance is driven by these numbers mostly.

receive window wont grow above 64K in these case. a tcpdump could confirm the issue.

Do you have 130000 pages of memory ?

Seems the net/ipv4/tcp.c code is wrong (or the comment is wrong)

Since its not 1/128 but 1/1024 ....

Quoted 13 lines
        /* Set per-socket limits to no more than 1/128 the pressure threshold */
        limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);
        limit = max(limit, 128UL);
        max_share = min(4UL*1024*1024, limit);

        sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
        sysctl_tcp_wmem[1] = 16*1024;
        sysctl_tcp_wmem[2] = max(64*1024, max_share);

        sysctl_tcp_rmem[0] = SK_MEM_QUANTUM;
        sysctl_tcp_rmem[1] = 87380;
        sysctl_tcp_rmem[2] = max(87380, max_share);

OK there is a bug introduced in commit
c43b874d5d714f271b80d4c3f49e05d0cbf51ed2
(tcp: properly initialize tcp memory limits)

I'll send a patch to change :

limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);

back to

limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);

You could try this :)

#11 lore raw
Quoted 49 lines · Eric Dumazet
Quoted 28 lines · Eric Dumazet
Quoted 6 lines · Michal Simek
Quoted 5 lines · Eric Dumazet
Quoted 2 lines · Michal Simek

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 130048

Quoted 8 lines
Quoted 3 lines

Are they default values, or tuned by admin ?

130048 bytes isnt enough to let TCP open its rcv window.

yep. Default value after powerup. What's wrong with that?

Michal

I guess your tcp performance is driven by these numbers mostly.

receive window wont grow above 64K in these case. a tcpdump could confirm the issue.

Do you have 130000 pages of memory ?

Seems the net/ipv4/tcp.c code is wrong (or the comment is wrong)

Since its not 1/128 but 1/1024 ....

Quoted 13 lines
         /* Set per-socket limits to no more than 1/128 the pressure threshold */
         limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 10);
         limit = max(limit, 128UL);
         max_share = min(4UL*1024*1024, limit);

         sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
         sysctl_tcp_wmem[1] = 16*1024;
         sysctl_tcp_wmem[2] = max(64*1024, max_share);

         sysctl_tcp_rmem[0] = SK_MEM_QUANTUM;
         sysctl_tcp_rmem[1] = 87380;
         sysctl_tcp_rmem[2] = max(87380, max_share);

OK there is a bug introduced in commit
c43b874d5d714f271b80d4c3f49e05d0cbf51ed2
(tcp: properly initialize tcp memory limits)

I'll send a patch to change :

Quoted 8 lines

limit = nr_free_buffer_pages()<< (PAGE_SHIFT - 10);

back to

limit = nr_free_buffer_pages()<< (PAGE_SHIFT - 7);

You could try this :)

sure.

~ # cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 1040384

Regression is till 5% which is much better on hw design without csum support.

I will also test it with csum support and let you know.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#12 lore raw

PATCH 1/1 tcp: restore correct limit

In reply to Eric Dumazet

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) added a regression on machines with low amount of memory, since sockets cant use 1/128 of memory but 1/1024

Fix this to match comment and previous behavior.

Cc Jason Wang <[email protected]>
Cc Glauber Costa <[email protected]>
---
 net/ipv4/tcp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +1 -1
index 5d54ed3..67d726e 100644
@@ -3302,7 +3302,7 @@ void __init tcp_init(void)
 
 	tcp_init_mem(&init_net);
 	/* Set per-socket limits to no more than 1/128 the pressure threshold */
-	limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);
+	limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
 	limit = max(limit, 128UL);
 	max_share = min(4UL*1024*1024, limit);
 
author Tested-by on v1 1/1
#13 lore raw

Re: [PATCH] tcp: restore correct limit

Quoted 18 lines · Eric Dumazet

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) added a regression on machines with low amount of memory, since sockets cant use 1/128 of memory but 1/1024

Fix this to match comment and previous behavior.

Cc Jason Wang<[email protected]>
Cc Glauber Costa<[email protected]>
---
  net/ipv4/tcp.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +0 -0
index 5d54ed3..67d726e 100644

net/ipv4/tcp.c void __init tcp_init(void) · line 3308

Quoted 8 lines
net/ipv4/tcp.c +1 -1
@@ -3302,7 +3302,7 @@ void __init tcp_init(void)
 
  	tcp_init_mem(&init_net);
  	/* Set per-socket limits to no more than 1/128 the pressure threshold */
-	limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 10);
+	limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 7);
  	limit = max(limit, 128UL);
  	max_share = min(4UL*1024*1024, limit);
 

hw design with csum is also much better.

Thanks for help,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#14 lore raw

Re: [PATCH] tcp: restore correct limit

Quoted 30 lines · Michal Simek
Quoted 23 lines · Eric Dumazet

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) added a regression on machines with low amount of memory, since sockets cant use 1/128 of memory but 1/1024

Fix this to match comment and previous behavior.

Cc Jason Wang<[email protected]>
Cc Glauber Costa<[email protected]>
---
  net/ipv4/tcp.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +0 -0
index 5d54ed3..67d726e 100644
@@ -3302,7 +3302,7 @@ void __init tcp_init(void)
 
      tcp_init_mem(&init_net);
      /* Set per-socket limits to no more than 1/128 the pressure 

threshold */

net/ipv4/tcp.c void __init tcp_init(void) · line 3307

Quoted 4 lines
net/ipv4/tcp.c +1 -1
-    limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 10);
+    limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 7);
      limit = max(limit, 128UL);
      max_share = min(4UL*1024*1024, limit);

hw design with csum is also much better.

Quoted 9 lines

Thanks for help,
Michal

Hi Michal and Eric:

Which version of kernel did you test, did you try the newest kernel? The reason I use (PAGE_SHIFT - 10) is in the commit before 3dc43e3, the limit were calculated with:

    limit = nr_free_buffer_pages() / 8;
    limit = max(limit, 128UL);
...
    limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);

So the rmem should be ok. But there's a defect (which I think does affect the regression) of my patch would could cause limit that we should shift after comparing with 128UL like:

    limit = nr_free_buffer_pages() / 8;
    limit = max(limit, 128UL) << (PAGE_SHIFT - 7);

Is anything I miss?

Thanks

#15 lore raw

Re: [PATCH] tcp: restore correct limit

Quoted 39 lines · Jason Wang
Quoted 29 lines · Michal Simek
Quoted 18 lines · Eric Dumazet

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) added a regression on machines with low amount of memory, since sockets cant use 1/128 of memory but 1/1024

Fix this to match comment and previous behavior.

Cc Jason Wang<[email protected]>
Cc Glauber Costa<[email protected]>

---
net/ipv4/tcp.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +0 -0
index 5d54ed3..67d726e 100644

net/ipv4/tcp.c void __init tcp_init(void) · line 3308

Quoted 8 lines
net/ipv4/tcp.c +1 -1
@@ -3302,7 +3302,7 @@ void __init tcp_init(void)
 
 tcp_init_mem(&init_net);
 /* Set per-socket limits to no more than 1/128 the pressure threshold */
- limit = nr_free_buffer_pages()<< (PAGE_SHIFT - 10);
+ limit = nr_free_buffer_pages()<< (PAGE_SHIFT - 7);
 limit = max(limit, 128UL);
 max_share = min(4UL*1024*1024, limit);
 

hw design with csum is also much better.

Quoted 9 lines

Thanks for help,
Michal

Quoted 3 lines

Hi Michal and Eric:

Which version of kernel did you test, did you try the newest kernel? The reason I use (PAGE_SHIFT - 10) is in the commit before 3dc43e3, the limit were calculated with:

I have tested it on 3.4.0-rc2.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#16 lore raw

Re: [PATCH] tcp: restore correct limit

In reply to Jason Wang
Quoted 51 lines · Jason Wang
Quoted 30 lines · Michal Simek
Quoted 23 lines · Eric Dumazet

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) added a regression on machines with low amount of memory, since sockets cant use 1/128 of memory but 1/1024

Fix this to match comment and previous behavior.

Cc Jason Wang<[email protected]>
Cc Glauber Costa<[email protected]>
---
  net/ipv4/tcp.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp.c +0 -0
index 5d54ed3..67d726e 100644
@@ -3302,7 +3302,7 @@ void __init tcp_init(void)
 
      tcp_init_mem(&init_net);
      /* Set per-socket limits to no more than 1/128 the pressure 

threshold */

net/ipv4/tcp.c void __init tcp_init(void) · line 3307

Quoted 4 lines
net/ipv4/tcp.c +1 -1
-    limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 10);
+    limit = nr_free_buffer_pages()<<  (PAGE_SHIFT - 7);
      limit = max(limit, 128UL);
      max_share = min(4UL*1024*1024, limit);

hw design with csum is also much better.

Quoted 9 lines

Thanks for help,
Michal

Hi Michal and Eric:

Which version of kernel did you test, did you try the newest kernel? The reason I use (PAGE_SHIFT - 10) is in the commit before 3dc43e3, the limit were calculated with:

     limit = nr_free_buffer_pages() / 8;
     limit = max(limit, 128UL);
...
     limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);
Quoted 9 lines

So the rmem should be ok. But there's a defect (which I think does affect the regression) of my patch would could cause limit that we should shift after comparing with 128UL like:

     limit = nr_free_buffer_pages() / 8;
     limit = max(limit, 128UL) << (PAGE_SHIFT - 7);

Is anything I miss?

Yes, probably.

Maybe you should check what was the situation on 2.6 kernels.

Your commit did not completely fix the 4acb41903b2 one

I dont feel its necessary to put in the changelog the complete bug history, since your commit does the needed tracking.

#17 lore raw

PATCH v2 1/1 tcp: restore correct limit

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) tried to fix a regression added in commits 4acb4190 & 3dc43e3,
but still get it wrong.

Result is machines with low amount of memory have too small tcp_rmem[2] value and slow tcp receives : Per socket limit being 1/1024 of memory instead of 1/128 in old kernels, so rcv window is capped to small values.

Fix this to match comment and previous behavior.

Cc Jason Wang <[email protected]>
Cc Glauber Costa <[email protected]>

---
v2: remove one useless "limit = max(limit, 128UL);" line

 net/ipv4/tcp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp.c +1 -2
index 5d54ed3..7758a83 100644
@@ -3302,8 +3302,7 @@ void __init tcp_init(void)
 
 	tcp_init_mem(&init_net);
 	/* Set per-socket limits to no more than 1/128 the pressure threshold */
-	limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10);
-	limit = max(limit, 128UL);
+	limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
 	max_share = min(4UL*1024*1024, limit);
 
 	sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
maintainer
#18 lore raw

Re: [PATCH v2] tcp: restore correct limit

From: Eric Dumazet <[email protected]>
Date: Tue, 10 Apr 2012 12:56:42 +0200

Quoted 9 lines

Commit c43b874d5d714f (tcp: properly initialize tcp memory limits) tried to fix a regression added in commits 4acb4190 & 3dc43e3,
but still get it wrong.

Result is machines with low amount of memory have too small tcp_rmem[2] value and slow tcp receives : Per socket limit being 1/1024 of memory instead of 1/128 in old kernels, so rcv window is capped to small values.

Quoted 5 lines

Fix this to match comment and previous behavior.

Cc Jason Wang <[email protected]>
Cc Glauber Costa <[email protected]>

Applied and queued up for -stable, thanks Eric.

#19 lore raw
In reply to Michal Simek
Quoted 9 lines · Michal Simek
Quoted 8 lines · Eric Dumazet
Quoted 5 lines · Eric Dumazet

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

Quoted 4 lines
Quoted 1 line

What is the driver you currently use on your platform ?

Using Xilinx ll_temac(in mainline) and axi_emac.

ll_temac allocates XTE_MAX_JUMBO_FRAME_SIZE frames, even for MTU=1500 ?

Trying to allocate smaller packets would definitely help your tcp receiver performance and overall reliability (order-0 allocations instead of order-2)

#20 lore raw
Quoted 10 lines · Eric Dumazet
Quoted 9 lines · Michal Simek
Quoted 8 lines · Eric Dumazet
Quoted 5 lines · Eric Dumazet

BTW, some NIC drivers are known to provide fat skb in their rx path, and need to be fixed as well. (Some others just lie about skb->truesize to avoid the tcp slowdown, see my previous iwlwifi patch)

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

What is the driver you currently use on your platform ?

Using Xilinx ll_temac(in mainline) and axi_emac.

ll_temac allocates XTE_MAX_JUMBO_FRAME_SIZE frames, even for MTU=1500 ?

yes.

Quoted 4 lines

Trying to allocate smaller packets would definitely help your tcp receiver performance and overall reliability (order-0 allocations instead of order-2)

There is long history for ll_temac and axi emac drivers. and if you compare them they are very similar with similar bugs.
In our distribution we are using older ll_temac driver where this is fixed. Performance is much higher if you allocate buffers for actual mtu.

Thanks,
Michal

P.S.: Our plan is to start to use mainline drivers and fixing them to get the same performance as we have with old one. It is one my todo list.

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#21 lore raw
Quoted 16 lines · Michal Simek
Quoted 2 lines · Eric Dumazet

ll_temac allocates XTE_MAX_JUMBO_FRAME_SIZE frames, even for MTU=1500 ?

yes.

Quoted 4 lines

Trying to allocate smaller packets would definitely help your tcp receiver performance and overall reliability (order-0 allocations instead of order-2)

There is long history for ll_temac and axi emac drivers. and if you compare them they are very similar with similar bugs.
In our distribution we are using older ll_temac driver where this is fixed. Performance is much higher if you allocate buffers for actual mtu.

Quoted 5 lines

Thanks,
Michal

P.S.: Our plan is to start to use mainline drivers and fixing them to get the same performance as we have with old one. It is one my todo list.

Ah good, because this 9000+pad versus 1500+pad allocation is way more problematic than the (small) change on skb->truesize you bisected ;)

#22 lore raw
Quoted 17 lines · Eric Dumazet
Quoted 16 lines · Michal Simek
Quoted 2 lines · Eric Dumazet

ll_temac allocates XTE_MAX_JUMBO_FRAME_SIZE frames, even for MTU=1500 ?

yes.

Quoted 4 lines

Trying to allocate smaller packets would definitely help your tcp receiver performance and overall reliability (order-0 allocations instead of order-2)

There is long history for ll_temac and axi emac drivers. and if you compare them they are very similar with similar bugs.
In our distribution we are using older ll_temac driver where this is fixed. Performance is much higher if you allocate buffers for actual mtu.

Quoted 8 lines
Quoted 5 lines

Thanks,
Michal

P.S.: Our plan is to start to use mainline drivers and fixing them to get the same performance as we have with old one. It is one my todo list.

Ah good, because this 9000+pad versus 1500+pad allocation is way more problematic than the (small) change on skb->truesize you bisected ;)

yeah I know. Currently for me is the most important thing to have stable driver which is ancient one and start to work on mainline to add there all features and do more testing before we will add it to customers.

I have found it because I have compared the same driver with different kernel versions and there was performance regression. Comparing with old one will show different results. :-)

I will keep you in the loop when I start to fix mainline driver.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
maintainer
#23 lore raw
In reply to Michal Simek

From: Michal Simek <[email protected]>
Date: Tue, 10 Apr 2012 13:38:33 +0200

Quoted 6 lines

There is long history for ll_temac and axi emac drivers. and if you compare
them they are very similar with similar bugs.
In our distribution we are using older ll_temac driver where this is fixed.
Performance is much higher if you allocate buffers for actual mtu.

You place an enormous burdon upon us when you ask us to analyze your performance problems and bugs when using out of tree drivers. Please do not do this.

A message that is not in the archive (sent off-list or not yet received): CAHTX3dLRR09_QaA2BzmbCVAUVVGvr_P3s2d1KEgPLMYGGVzrpA@mail.gmail.com

maintainer
#25 lore raw

From: Michal Simek <[email protected]>
Date: Tue, 10 Apr 2012 15:49:17 +0200

Quoted 6 lines

I reported problem with performance regression on the same drvier between one kernel version and the newer version. Even with pointer to specific patch which I have identified as source of the problem. It has nothing to do with performance of driver itself because identified patch directly points to generic network code not to mainline driver and performance problem in it.

The size and attributes of the SKBs allocated is a clear important variable in this bug, and you've just described how the SKBs allocated are of completely different sizes in the driver you're using compared to the one in the tree.

You were very fortunate that Eric was able to track down the cause even with this unknown variable, but in other cases this can lead to wild goose chases which waste developer time.

So, again, please do not do this in the future, reproduce your problems with upstream sources only.

A message that is not in the archive (sent off-list or not yet received): CAHTX3dLz9+A48u6ckGiDytBkyMrvgV0Zi3xfnt4RBmoagJbndA@mail.gmail.com

maintainer
#27 lore raw

From: Michal Simek <[email protected]>
Date: Tue, 10 Apr 2012 16:04:18 +0200

Quoted 3 lines

I didn't report problem on any private held driver. I think you have misunderstand our later discussion about ll_temac driver where are some problems which at least

Thanks for the clarification.

#28 lore raw
Quoted 8 lines · David Miller

From: Michal Simek<[email protected]>
Date: Tue, 10 Apr 2012 16:04:18 +0200

Quoted 3 lines

I didn't report problem on any private held driver. I think you have misunderstand our later discussion about ll_temac driver where are some problems which at least

Thanks for the clarification.

No worries.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#29 lore raw
In reply to Eric Dumazet
Quoted 30 lines · Eric Dumazet
Quoted 11 lines · Michal Simek

Hi Eric,

I have spent some time to investigate what it is causing regression on our network bechmark and I have identified that your patch "net: more accurate skb truesize" is causing that.

I see regression especially on incoming tcp (RX) connection which is 20%. On TX I see regression till 5%.

In general microblaze systems are pretty sensitive for memory usage and working with it. Increasing packet sizes has big impact on performance.
I was surprised that regression is so high.

Quoted 9 lines

From microblaze point of view is more important to remove that performance regression
than having more accurate memory accounting. 20% performance regression is simple so high for that.
Isn't there any other way to doing better memory accounting?
Or is there any workaround which would be possible to use?

Thanks,
Michal

Hi Michal

We are currently working on the issue.

TCP stack was a bit optimistic in the ideal skb->len / skb->truesize ratio that happened to 'mostly work' before my patch, but not anymore after it.

Quoted 8 lines

memory accounting was wrong, we really wanted to be accurate, or risk OOM and crashes.

Now we must fix tcp.

In the meantime you could try :

echo 1>/proc/sys/net/ipv4/tcp_adv_win_scale

will retest it and let you know.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian