Message ID | 1334052194.3126.66.camel@edumazet-glaptop |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
On 04/10/2012 12:03 PM, Eric Dumazet wrote: > 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. > > Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com> > Cc: Jason Wang<jasowang@redhat.com> > Cc: Glauber Costa<glommer@parallels.com> > --- > net/ipv4/tcp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c > index 5d54ed3..67d726e 100644 > --- a/net/ipv4/tcp.c > +++ b/net/ipv4/tcp.c > @@ -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. Tested-by: Michal Simek <monstr@monstr.eu> Thanks for help, Michal
On 04/10/2012 06:14 PM, Michal Simek wrote: > On 04/10/2012 12:03 PM, Eric Dumazet wrote: >> 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. >> >> Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com> >> Cc: Jason Wang<jasowang@redhat.com> >> Cc: Glauber Costa<glommer@parallels.com> >> --- >> net/ipv4/tcp.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c >> index 5d54ed3..67d726e 100644 >> --- a/net/ipv4/tcp.c >> +++ b/net/ipv4/tcp.c >> @@ -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. > Tested-by: Michal Simek <monstr@monstr.eu> > > 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 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 04/10/2012 12:29 PM, Jason Wang wrote: > On 04/10/2012 06:14 PM, Michal Simek wrote: >> On 04/10/2012 12:03 PM, Eric Dumazet wrote: >>> 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. >>> >>> Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com> >>> Cc: Jason Wang<jasowang@redhat.com> >>> Cc: Glauber Costa<glommer@parallels.com> >>> --- >>> net/ipv4/tcp.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c >>> index 5d54ed3..67d726e 100644 >>> --- a/net/ipv4/tcp.c >>> +++ b/net/ipv4/tcp.c >>> @@ -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. >> Tested-by: Michal Simek <monstr@monstr.eu> >> >> 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: I have tested it on 3.4.0-rc2. Michal
On Tue, 2012-04-10 at 18:29 +0800, Jason Wang wrote: > On 04/10/2012 06:14 PM, Michal Simek wrote: > > On 04/10/2012 12:03 PM, Eric Dumazet wrote: > >> 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. > >> > >> Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com> > >> Cc: Jason Wang<jasowang@redhat.com> > >> Cc: Glauber Costa<glommer@parallels.com> > >> --- > >> net/ipv4/tcp.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c > >> index 5d54ed3..67d726e 100644 > >> --- a/net/ipv4/tcp.c > >> +++ b/net/ipv4/tcp.c > >> @@ -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. > > Tested-by: Michal Simek <monstr@monstr.eu> > > > > 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? > 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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 5d54ed3..67d726e 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -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);
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. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Glauber Costa <glommer@parallels.com> --- net/ipv4/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html