linux/fs/nfs
Alexey Dobriyan c7d03a00b5 netns: make struct pernet_operations::id unsigned int
Make struct pernet_operations::id unsigned.

There are 2 reasons to do so:

1)
This field is really an index into an zero based array and
thus is unsigned entity. Using negative value is out-of-bound
access by definition.

2)
On x86_64 unsigned 32-bit data which are mixed with pointers
via array indexing or offsets added or subtracted to pointers
are preffered to signed 32-bit data.

"int" being used as an array index needs to be sign-extended
to 64-bit before being used.

	void f(long *p, int i)
	{
		g(p[i]);
	}

  roughly translates to

	movsx	rsi, esi
	mov	rdi, [rsi+...]
	call 	g

MOVSX is 3 byte instruction which isn't necessary if the variable is
unsigned because x86_64 is zero extending by default.

Now, there is net_generic() function which, you guessed it right, uses
"int" as an array index:

	static inline void *net_generic(const struct net *net, int id)
	{
		...
		ptr = ng->ptr[id - 1];
		...
	}

And this function is used a lot, so those sign extensions add up.

Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
messing with code generation):

	add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)

Unfortunately some functions actually grow bigger.
This is a semmingly random artefact of code generation with register
allocator being used differently. gcc decides that some variable
needs to live in new r8+ registers and every access now requires REX
prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
used which is longer than [r8]

However, overall balance is in negative direction:

	add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
	function                                     old     new   delta
	nfsd4_lock                                  3886    3959     +73
	tipc_link_build_proto_msg                   1096    1140     +44
	mac80211_hwsim_new_radio                    2776    2808     +32
	tipc_mon_rcv                                1032    1058     +26
	svcauth_gss_legacy_init                     1413    1429     +16
	tipc_bcbase_select_primary                   379     392     +13
	nfsd4_exchange_id                           1247    1260     +13
	nfsd4_setclientid_confirm                    782     793     +11
		...
	put_client_renew_locked                      494     480     -14
	ip_set_sockfn_get                            730     716     -14
	geneve_sock_add                              829     813     -16
	nfsd4_sequence_done                          721     703     -18
	nlmclnt_lookup_host                          708     686     -22
	nfsd4_lockt                                 1085    1063     -22
	nfs_get_client                              1077    1050     -27
	tcf_bpf_init                                1106    1076     -30
	nfsd4_encode_fattr                          5997    5930     -67
	Total: Before=154856051, After=154854321, chg -0.00%

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-18 10:59:15 -05:00
..
blocklayout pnfs/blocklayout: fix last_write_offset incorrectly set to page boundary 2016-10-13 16:42:53 -04:00
filelayout pNFS/files: filelayout_write_done_cb must call nfs_writeback_update_inode() 2016-07-21 09:46:42 -04:00
flexfilelayout NFSv4.x: Allow callers of nfs_remove_bad_delegation() to specify a stateid 2016-09-27 14:33:37 -04:00
objlayout mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
Kconfig
Makefile NFS: Do not serialise O_DIRECT reads and writes 2016-07-05 19:11:04 -04:00
cache_lib.c NFS: cache_lib: use complete() instead of complete_all() 2016-09-23 09:40:12 -04:00
cache_lib.h
callback.c NFSv4.x: Add kernel parameter to control the callback server 2016-09-19 13:08:36 -04:00
callback.h nfs: add handling for CB_NOTIFY_LOCK in client 2016-09-22 13:56:04 -04:00
callback_proc.c nfs: allow blocking locks to be awoken by lock callbacks 2016-09-22 15:54:27 -04:00
callback_xdr.c nfs: add handling for CB_NOTIFY_LOCK in client 2016-09-22 13:56:04 -04:00
client.c NFS: Ignore connections that have cl_rpcclient uninitialized 2016-11-07 16:11:29 -05:00
delegation.c NFS: Always call nfs_inode_find_state_and_recover() when revoking a delegation 2016-09-27 14:35:04 -04:00
delegation.h NFSv4: nfs_inode_find_state_and_recover() should check all stateids 2016-09-27 14:34:35 -04:00
dir.c NFS client updates for Linux 4.9 2016-10-13 21:28:20 -07:00
direct.c NFS: direct: use complete() instead of complete_all() 2016-09-23 09:14:16 -04:00
dns_resolve.c
dns_resolve.h
file.c NFS client updates for Linux 4.9 2016-10-13 21:28:20 -07:00
fscache-index.c
fscache.c
fscache.h
getroot.c
inode.c netns: make struct pernet_operations::id unsigned int 2016-11-18 10:59:15 -05:00
internal.h NFS client updates for Linux 4.9 2016-10-13 21:28:20 -07:00
io.c NFS: Do not serialise O_DIRECT reads and writes 2016-07-05 19:11:04 -04:00
iostat.h
mount_clnt.c
namespace.c NFS: Trim extra slash in v4 nfs_path 2016-10-24 12:06:01 -04:00
netns.h netns: make struct pernet_operations::id unsigned int 2016-11-18 10:59:15 -05:00
nfs.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c posix_acl: Inode acl caching fixes 2016-03-31 00:30:15 -04:00
nfs3client.c nfs4: flexfiles: respect noresvport when establishing connections to DSes 2016-07-19 16:23:25 -04:00
nfs3proc.c vfs: Remove {get,set,remove}xattr inode operations 2016-10-07 21:48:36 -04:00
nfs3super.c
nfs3xdr.c
nfs4_fs.h NFSv4.1: Test delegation stateids when server declares "some state revoked" 2016-09-27 14:33:44 -04:00
nfs4client.c nfs: allow blocking locks to be awoken by lock callbacks 2016-09-22 15:54:27 -04:00
nfs4file.c switch generic_file_splice_read() to use of ->read_iter() 2016-10-05 18:23:56 -04:00
nfs4getroot.c
nfs4idmap.c KEYS: Add a facility to restrict new links into a keyring 2016-04-11 22:37:37 +01:00
nfs4idmap.h
nfs4namespace.c qstr: constify instances in nfs 2016-07-20 23:30:06 -04:00
nfs4proc.c NFS client bugfixes for Linux 4.9 2016-10-21 19:06:59 -07:00
nfs4renewd.c NFSv4: Cap the transport reconnection timer at 1/2 lease period 2016-08-05 19:22:22 -04:00
nfs4session.c fs/nfs: Fix used uninitialized warn in nfs4_slot_seqid_in_use() 2016-11-07 16:11:30 -05:00
nfs4session.h NFSv4.1: Don't deadlock the state manager on the SEQUENCE status flags 2016-09-27 14:31:27 -04:00
nfs4state.c NFSv4: If recovery failed for a specific open stateid, then don't retry 2016-09-27 14:35:27 -04:00
nfs4super.c
nfs4sysctl.c nfs: do not initialise statics to 0 2015-12-28 09:57:15 -05:00
nfs4trace.c pNFS: Modify pnfs_update_layout tracepoints to use layout stateid 2015-12-28 09:57:14 -05:00
nfs4trace.h tracing: Use __get_str() when manipulating strings 2016-07-15 15:52:20 -04:00
nfs4xdr.c fs: nfs: Make nfs boot time y2038 safe 2016-10-04 16:20:26 -04:00
nfs42.h NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfs42proc.c NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic 2016-10-04 16:30:54 -04:00
nfs42xdr.c NFSv4.2: Fix warning "variable ‘stateids’ set but not used" 2016-07-24 17:36:06 -04:00
nfsroot.c
nfstrace.c
nfstrace.h NFS client updates for Linux 4.8 2016-07-30 16:33:25 -07:00
pagelist.c mm: remove page_file_index 2016-10-07 18:46:28 -07:00
pnfs.c NFS: Don't print a pNFS error if we aren't using pNFS 2016-11-07 16:11:30 -05:00
pnfs.h pnfs: add a new mechanism to select a layout driver according to an ordered list 2016-09-19 13:11:13 -04:00
pnfs_dev.c
pnfs_nfs.c NFS pnfs data server multipath session trunking 2016-09-19 13:08:37 -04:00
proc.c fs: rename "rename2" i_op to "rename" 2016-09-27 11:03:58 +02:00
read.c mm: remove page_file_index 2016-10-07 18:46:28 -07:00
super.c NFSv4.x: Add kernel parameter to control the callback server 2016-09-19 13:08:36 -04:00
symlink.c switch ->get_link() to delayed_call, kill ->put_link() 2015-12-30 13:01:03 -05:00
sysctl.c
unlink.c qstr: constify instances in nfs 2016-07-20 23:30:06 -04:00
write.c mm: remove page_file_index 2016-10-07 18:46:28 -07:00