[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231207062520.21109-1-kuniyu@amazon.com>
Date: Thu, 7 Dec 2023 15:25:20 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <david.laight@...lab.com>
CC: <davem@...emloft.net>, <dsahern@...nel.org>, <edumazet@...gle.com>,
<jakub@...udflare.com>, <kuba@...nel.org>, <martineau@...nel.org>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>, <stephen@...workplumber.org>,
<kuniyu@...zon.com>
Subject: Re: [PATCH net-next v2] Use READ/WRITE_ONCE() for IP local_port_range.
From: David Laight <David.Laight@...LAB.COM>
Date: Wed, 6 Dec 2023 13:44:20 +0000
> Commit 227b60f5102cd added a seqlock to ensure that the low and high
> port numbers were always updated together.
> This is overkill because the two 16bit port numbers can be held in
> a u32 and read/written in a single instruction.
>
> More recently 91d0b78c5177f added support for finer per-socket limits.
> The user-supplied value is 'high << 16 | low' but they are held
> separately and the socket options protected by the socket lock.
>
> Use a u32 containing 'high << 16 | low' for both the 'net' and 'sk'
> fields and use READ_ONCE()/WRITE_ONCE() to ensure both values are
> always updated together.
>
> Change (the now trival) inet_get_local_port_range() to a static inline
> to optimise the calling code.
> (In particular avoiding returning integers by reference.)
>
> Signed-off-by: David Laight <david.laight@...lab.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
Powered by blists - more mailing lists