All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	santosh.shilimkar@oracle.com, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next v3 1/2] RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
Date: Wed, 16 Mar 2016 07:06:06 -0400	[thread overview]
Message-ID: <20160316110606.GA21307@oracle.com> (raw)
In-Reply-To: <56E93596.90503@stressinduktion.org>

On (03/16/16 11:29), Hannes Frederic Sowa wrote:
> 
> Normally we kmemdup a table per netns and update its data pointer,
> so we can reuse the proc_doint_minmax functions.

I actually thought of doing a separate kzalloc per netns, 
but it seemed like it would be a lot of memory bloat, when really,
all I want is just the per-netns data.

I could go and duplicate the whole table, but is there a significant
benefit to that, or some bad bug with this approach? 

One dubious (yes, I know, "solution looking for problem" category)
benefit is that this hack allows me to have both global, and per netns,
tunables... plus the reduced memory footprint (latter is probably
more interesting than former?)

> >+	rtn->rds_tcp_sysctl = register_net_sysctl(net, "net/rds/tcp",
> >+						  rds_tcp_sysctl_table);
> 
> You should add proper error handling here?

Agree, I will send this out in the next rev.

> >+	rtn->sndbuf_size = max_t(u32, user_atoi(buffer, *lenp) * 2,
> >+				 SOCK_MIN_SNDBUF);
> 
> user_atoi does return negative error values (as you implemented it),
> I think you should check before, otherwise the signed to unsigned
> conversion can cause huge memory allocations.

yes, good catch, that will have to be split into two lines. Shall
be fixing this in v4.

> Why actually implement user_atoi?

errhm. cut/paste from other drivers that do this. I needed to
do the copy_from_user() + kstrtoul, and user_atoi had some 
additional checks that seemed useful. 

--Sowmini

  reply	other threads:[~2016-03-16 11:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 18:53 [PATCH net-next v3 0/2] RDS: TCP: tunable socket buffer parameters Sowmini Varadhan
2016-03-15 18:53 ` [PATCH net-next v3 1/2] RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket Sowmini Varadhan
2016-03-15 19:21   ` santosh shilimkar
2016-03-16 10:29   ` Hannes Frederic Sowa
2016-03-16 11:06     ` Sowmini Varadhan [this message]
2016-03-16 11:10     ` Sowmini Varadhan
2016-03-16 11:26       ` Hannes Frederic Sowa
2016-03-16 11:32         ` Sowmini Varadhan
2016-03-15 18:53 ` [PATCH net-next v3 2/2] RDS: TCP: Remove unused constant Sowmini Varadhan
2016-03-15 19:22   ` santosh shilimkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160316110606.GA21307@oracle.com \
    --to=sowmini.varadhan@oracle.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=santosh.shilimkar@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.