Re: [PATCH v2] docs: proc.rst: meminfo: briefly describe gaps in memory accounting

2021-04-20 Thread Alexey Dobriyan
On Tue, Apr 20, 2021 at 03:57:07PM +0200, Michal Hocko wrote: > On Tue 20-04-21 14:24:30, Matthew Wilcox wrote: > > On Tue, Apr 20, 2021 at 03:13:54PM +0300, Mike Rapoport wrote: > > > Add a paragraph that explains that it may happen that the counters in > > > /proc/meminfo do not add up to the ove

[PATCH net-next] netlink: simplify nl_set_extack_cookie_u64(), nl_set_extack_cookie_u32()

2021-04-17 Thread Alexey Dobriyan
Taking address of a function argument directly works just fine. Signed-off-by: Alexey Dobriyan --- include/linux/netlink.h | 12 1 file changed, 4 insertions(+), 8 deletions(-) --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -129,23 +129,19 @@ struct

[PATCH net-next] atm: delete include/linux/atm_suni.h

2021-03-14 Thread Alexey Dobriyan
This file has been effectively empty since 2.3.99-pre3 ! Signed-off-by: Alexey Dobriyan --- drivers/atm/fore200e.c |1 - drivers/atm/suni.c |1 - include/linux/atm_suni.h | 12 3 files changed, 14 deletions(-) --- a/drivers/atm/fore200e.c +++ b/drivers/atm

[PATCH 12/11] pragma once: scripted treewide conversion

2021-02-28 Thread Alexey Dobriyan
misc stuff). Not compile tested on csky, hexagon, nds32, openrisc. Love, Alexey Signed-off-by: Alexey Dobriyan #!/bin/sh -x find . -type f -name '*.h' -print |\ LC_ALL=C sort |\ sed -e 's#^./##g' |\ xargs ./script

[PATCH 10/11] pragma once: delete few backslashes

2021-02-28 Thread Alexey Dobriyan
>From 251ca5673886b5bb0a42004944290b9d2b267a4a Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Fri, 19 Feb 2021 13:37:24 +0300 Subject: [PATCH 10/11] pragma once: delete few backslashes Some macros contain one backslash too many and end up being the last macro in a header file. When #pra

[PATCH 01/11] pragma once: delete include/linux/atm_suni.h

2021-02-28 Thread Alexey Dobriyan
>From c17ac63e1334c742686cd411736699c1d34d45a7 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Wed, 10 Feb 2021 21:07:45 +0300 Subject: [PATCH 01/11] pragma once: delete include/linux/atm_suni.h This file has been empty since 2.3.99-pre3! Delete it instead of converting to #pragma o

Re: [PATCH v2 net-next] ibmvnic: workaround QT Creator/libCPlusPlus segfault

2021-01-21 Thread Alexey Dobriyan
On Thu, Jan 21, 2021 at 06:44:54PM -0800, Jakub Kicinski wrote: > On Fri, 22 Jan 2021 01:07:39 +0300 Alexey Dobriyan wrote: > > My name is Alexey and I've tried to use IDE for kernel development. > > > > QT Creator segfaults while parsing ibmvnic.c which is annoying as

[PATCH v2 net-next] ibmvnic: workaround QT Creator/libCPlusPlus segfault

2021-01-21 Thread Alexey Dobriyan
hide the offending code. https://bugzilla.redhat.com/show_bug.cgi?id=1886548 Signed-off-by: Alexey Dobriyan --- fix modular case drivers/net/ethernet/ibm/ibmvnic.c |3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmv

[PATCH net-next] ibmvnic: workaround QT Creator/libCPlusPlus segfault

2021-01-21 Thread Alexey Dobriyan
hide the offending code. https://bugzilla.redhat.com/show_bug.cgi?id=1886548 Signed-off-by: Alexey Dobriyan --- drivers/net/ethernet/ibm/ibmvnic.c |3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -5080,6 +5

Re: [PATCH 1/2] mm: add GFP mask param to strndup_user

2020-08-16 Thread Alexey Dobriyan
On Sat, Aug 15, 2020 at 11:42:10PM +0100, Al Viro wrote: > On Sat, Aug 15, 2020 at 11:23:43AM -0700, Pascal Bouchareine wrote: > > Let caller specify allocation. > > Preserve existing calls with GFP_USER. > > Bloody bad idea, unless you slap a BUG_ON(flags & GFP_ATOMIC) on it, > to make sure nobod

Re: [PATCH] linux++, this: rename "struct notifier_block *this"

2020-06-20 Thread Alexey Dobriyan
On Fri, Jun 19, 2020 at 11:37:47AM -0700, Linus Torvalds wrote: > On Thu, Jun 18, 2020 at 2:06 PM Alexey Dobriyan wrote: > > > > Rename > > struct notifier_block *this > > to > > struct notifier_block *nb > > > > "nb" is argua

[PATCH] linux++, this: rename "struct notifier_block *this"

2020-06-18 Thread Alexey Dobriyan
25.c Both gcc and g++ accept new name. It would make my adventure of carrying linux++ patchset slightly less miserable. Signed-off-by: Alexey Dobriyan --- arch/alpha/kernel/setup.c|2 +- arch/mips/kernel/pm-cps.c|2 +- arch/mips/s

[PATCH] net: make sock_prot_memory_pressure() return "const char *"

2019-10-03 Thread Alexey Dobriyan
This function returns string literals which are "const char *". Signed-off-by: Alexey Dobriyan --- net/core/sock.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3493,7 +3493,7 @@ static long sock_prot_memory_allocated(st

[PATCH] igmp: uninline ip_mc_validate_checksum()

2019-10-03 Thread Alexey Dobriyan
This function is only used via function pointer. "inline" doesn't hurt given that taking address of an inline function forces out-of-line version but it doesn't help either. Signed-off-by: Alexey Dobriyan --- net/ipv4/igmp.c |2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH] xfrm: ifdef setsockopt(UDP_ENCAP_ESPINUDP/UDP_ENCAP_ESPINUDP_NON_IKE)

2019-10-03 Thread Alexey Dobriyan
If IPsec is not configured, there is no reason to delay the inevitable. Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |7 --- net/ipv4/udp.c |2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1613,13 +1613,6

[PATCH net-next] net: spread "enum sock_flags"

2019-10-03 Thread Alexey Dobriyan
Some ints are "enum sock_flags" in fact. Signed-off-by: Alexey Dobriyan --- include/net/sock.h |2 +- net/core/sock.c|5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2512,7 +2512,7 @@ static inline bool s

[PATCH net-next] net, uapi: fix -Wpointer-arith warnings

2019-10-03 Thread Alexey Dobriyan
error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith] Those are theoretical probably but kernel doesn't control compiler flags in userspace. Signed-off-by: Alexey Dobriyan --- include/uapi/linux/netfilter_arp/arp_tables.h |2 +- include/uapi/lin

[PATCH net-next] net: use "nb" for notifier blocks

2019-08-05 Thread Alexey Dobriyan
Use more pleasant looking struct notifier_block *nb, instead of "this". Signed-off-by: Alexey Dobriyan --- drivers/net/bonding/bond_main.c |2 +- drivers/net/ethernet/broadcom/cnic.c |2 +- drivers/net/ethernet/chelsio/cxgb4/cx

[PATCH net-next] net: delete "register" keyword

2019-08-05 Thread Alexey Dobriyan
Delete long obsoleted "register" keyword. Signed-off-by: Alexey Dobriyan --- drivers/net/ethernet/apple/bmac.c |4 ++-- drivers/net/slip/slhc.c | 30 +++--- net/netfilter/ipvs/ip_vs_ctl.c|4 ++-- net/netfilter/ipvs/ip_vs_lblcr.c |

Re: [PATCH 1/2] proc: revalidate directories created with proc_net_mkdir()

2019-07-07 Thread Alexey Dobriyan
On Sun, Jul 07, 2019 at 02:03:20AM +0100, Al Viro wrote: > On Sat, Jul 06, 2019 at 07:52:02PM +0300, Alexey Dobriyan wrote: > > +struct proc_dir_entry *_proc_mkdir(const char *name, umode_t mode, > > + struct proc_dir_entry **parent, void *data)

[PATCH 2/2] net: apply proc_net_mkdir() harder

2019-07-06 Thread Alexey Dobriyan
ned-off-by: "Hallsmark, Per" Signed-off-by: Alexey Dobriyan --- drivers/net/bonding/bond_procfs.c |2 +- net/core/pktgen.c |2 +- net/ipv4/netfilter/ipt_CLUSTERIP.c |2 +- net/ipv6/proc.c|2 +- net/netfilter/xt_hashlimit.c |4

[PATCH 1/2] proc: revalidate directories created with proc_net_mkdir()

2019-07-06 Thread Alexey Dobriyan
quot; line. [redid original patch --adobriyan] Reported-by: "Hallsmark, Per" Signed-off-by: Alexey Dobriyan --- fs/proc/generic.c | 25 ++--- fs/proc/internal.h |3 +++ fs/proc/proc_net.c | 17 + include/li

[PATCH] net: fixup type in netdev_start_xmit()

2018-11-24 Thread Alexey Dobriyan
Return code should be formally "netdev_tx_t". Signed-off-by: Alexey Dobriyan --- include/linux/netdevice.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4373,7 +4373,7 @@ static inline netdev_tx_t netdev_

Re: simplify procfs code for seq_file instances V2

2018-05-09 Thread Alexey Dobriyan
On Sun, May 06, 2018 at 06:45:31PM +0100, Al Viro wrote: > On Sun, May 06, 2018 at 08:19:49PM +0300, Alexey Dobriyan wrote: > > @@ -62,9 +62,9 @@ struct proc_dir_entry { > > umode_t mode; > > u8 namelen; > > #ifdef CONFIG_64BIT > > -#define SI

Re: simplify procfs code for seq_file instances V2

2018-05-06 Thread Alexey Dobriyan
On Wed, Apr 25, 2018 at 05:47:47PM +0200, Christoph Hellwig wrote: > Changes since V1: > - open code proc_create_data to avoid setting not fully initialized >entries live > - use unsigned int for state_size Need this to maintain sizeof(struct proc_dir_entry): Otherwise ACK fs/proc/ part. d

Re: simplify procfs code for seq_file instances

2018-04-25 Thread Alexey Dobriyan
On Tue, Apr 24, 2018 at 06:06:53PM +0200, Christoph Hellwig wrote: > On Tue, Apr 24, 2018 at 08:19:16AM -0700, Andrew Morton wrote: > > > > I want to ask if it is time to start using poorman function overloading > > > > with _b_c_e(). There are millions of allocation functions for example, > > > >

Re: simplify procfs code for seq_file instances

2018-04-19 Thread Alexey Dobriyan
> git://git.infradead.org/users/hch/misc.git proc_create I want to ask if it is time to start using poorman function overloading with _b_c_e(). There are millions of allocation functions for example, all slightly difference, and people will add more. Seeing /proc interfaces doubled like this

Re: [PATCH 03/39] proc: introduce proc_create_seq_private

2018-04-19 Thread Alexey Dobriyan
On Thu, Apr 19, 2018 at 02:41:04PM +0200, Christoph Hellwig wrote: > Variant of proc_create_data that directly take a struct seq_operations > --- a/fs/proc/internal.h > +++ b/fs/proc/internal.h > @@ -45,6 +45,7 @@ struct proc_dir_entry { > const struct inode_operations *proc_iops; > co

Re: [PATCH 14/39] proc: introduce proc_create_net_single

2018-04-19 Thread Alexey Dobriyan
On Thu, Apr 19, 2018 at 02:41:15PM +0200, Christoph Hellwig wrote: > Variant of proc_create_data that directly take a seq_file show > +struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, > + struct proc_dir_entry *parent, > + int (*show)(struct seq

Re: [PATCH 02/39] proc: introduce proc_create_seq{,_data}

2018-04-19 Thread Alexey Dobriyan
On Thu, Apr 19, 2018 at 02:41:03PM +0200, Christoph Hellwig wrote: > Variants of proc_create{,_data} that directly take a struct seq_operations > argument and drastically reduces the boilerplate code in the callers. > +static int proc_seq_open(struct inode *inode, struct file *file) > +{ > + s

[PATCH 21/25] slab: make usercopy region 32-bit

2018-03-05 Thread Alexey Dobriyan
If kmem case sizes are 32-bit, then usecopy region should be too. Cc: netdev@vger.kernel.org Signed-off-by: Alexey Dobriyan --- include/linux/slab.h | 2 +- include/linux/slab_def.h | 4 ++-- include/linux/slub_def.h | 4 ++-- include/net/sock.h | 4 ++-- mm/slab.h| 4

[PATCH] xfrm: mark kmem_caches as __ro_after_init

2018-02-24 Thread Alexey Dobriyan
Kmem caches aren't relocated once set up. Signed-off-by: Alexey Dobriyan --- net/xfrm/xfrm_input.c |3 ++- net/xfrm/xfrm_policy.c |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -9,6 +9,7 @@ */ #in

[PATCH] net: make kmem caches as __ro_after_init

2018-02-24 Thread Alexey Dobriyan
All kmem caches aren't reallocated once set up. Signed-off-by: Alexey Dobriyan --- net/core/net_namespace.c |2 +- net/core/skbuff.c|4 ++-- net/ipv4/fib_trie.c |5 +++-- net/ipv4/inetpeer.c |3 ++- net/ipv4/ipmr.c |3 ++- net/soc

Re: [PATCH] net: Allow mac_pton() to work on non-NULL terminated strings

2018-02-23 Thread Alexey Dobriyan
/* Don't dirty result unless string is valid MAC. */ > for (i = 0; i < ETH_ALEN; i++) { > if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1])) Short string will bail in the loop, indeed. Reviewed-by: Alexey Dobriyan

Re: [PATCH v2] net: delete /proc THIS_MODULE references

2018-01-15 Thread Alexey Dobriyan
On Mon, Jan 15, 2018 at 02:18:00PM -0800, Stephen Hemminger wrote: > On Tue, 16 Jan 2018 00:42:40 +0300 > Alexey Dobriyan wrote: > > > /proc has been ignoring struct file_operations::owner field for 10 years. > > Specifically, it started with commit > > 786d7e1612f0b

[PATCH v2] net: delete /proc THIS_MODULE references

2018-01-15 Thread Alexey Dobriyan
->i_fop = &proc_reg_file_ops; + else + inode->i_fop = de->proc_fops; + } VFS stopped pinning module at this point. Signed-off-by: Alexey Dobriyan --- net/8021q/vlanproc.c |2 --

Re: [PATCH] net: delete /proc THIS_MODULE references

2018-01-15 Thread Alexey Dobriyan
On Mon, Jan 15, 2018 at 02:50:12PM -0500, David Miller wrote: > From: Alexey Dobriyan > Date: Sat, 13 Jan 2018 20:11:52 +0300 > > > /proc has been ignoring struct file_operations::owner field for ages. > > > > Signed-off-by: Alexey Dobriyan > > What, then, mak

[PATCH] net: delete /proc THIS_MODULE references

2018-01-13 Thread Alexey Dobriyan
/proc has been ignoring struct file_operations::owner field for ages. Signed-off-by: Alexey Dobriyan --- net/8021q/vlanproc.c |2 -- net/appletalk/aarp.c |1 - net/appletalk/atalk_proc.c |3 --- net/atm/br2684.c |1 - net

[PATCH 3/3] net: dst: make dst->obsolete 8-bit

2017-12-06 Thread Alexey Dobriyan
dst_dev_put 104 99 -5 xfrm_lookup 20272021 -6 update_or_create_fnhe 13391329 -10 Signed-off-by: Alexey Dobriyan --- include/net/dst.h | 8 net/core/dst.c

[PATCH 2/3] net: dst: switch to 8-bit dst->flags

2017-12-06 Thread Alexey Dobriyan
66 61 -5 Signed-off-by: Alexey Dobriyan --- include/net/dst.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/net/dst.h b/include/net/dst.h index 0f0905bda423..25decfa4e14a 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -31,7

[PATCH 1/3] net: dst: add and use dst_flags_t

2017-12-06 Thread Alexey Dobriyan
Typedef dst->flags for checking with sparse. Signed-off-by: Alexey Dobriyan --- drivers/net/vrf.c | 2 +- include/net/dst.h | 23 --- include/net/ip6_route.h | 2 +- net/core/dst.c | 4 ++-- net/ipv6/route.c| 4 ++-- 5 files changed,

Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook

2017-11-07 Thread Alexey Dobriyan
> - BUG_ON(!list_empty(grace_list)); > + WARN_ONCE(!list_empty(grace_list), > + "net %x %s: grace_list is not empty\n", > + net->ns.inum, __func__); * printing __func__ is unnecessary as it will be on top of the stacktrace anyway, * message duplicates condition

[PATCH 2/2] slab, slub, slob: convert slab_flags_t to 32-bit

2017-10-21 Thread Alexey Dobriyan
function old new delta sysfs_slab_add 720 719 -1 ... check_object 699 676 -23 Signed-off-by: Alexey Dobriyan --- include/linux/slab

[PATCH 1/2] slab, slub, slob: add slab_flags_t

2017-10-21 Thread Alexey Dobriyan
Add sparse-checked slab_flags_t for struct kmem_cache::flags (SLAB_POISON, etc). SLAB is bloated temporarily by switching to "unsigned long", but only temporarily. Signed-off-by: Alexey Dobriyan --- fs/ecryptfs/main.c |2 - fs/xfs/kmem.h|2 - include/lin

[PATCH] net: make ->ndo_get_phys_port_name accept 32-bit len

2017-10-07 Thread Alexey Dobriyan
nfp_port_get_phys_port_name 180 170 -10 Signed-off-by: Alexey Dobriyan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c|2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c|2 +- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |2 +- drivers/net

[PATCH] arp: make arp_hdr_len() return unsigned int

2017-09-26 Thread Alexey Dobriyan
ff-by: Alexey Dobriyan --- drivers/net/bonding/bond_main.c |3 ++- include/linux/if_arp.h |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2491,7 +2491,8 @@ int bond_arp_rcv(const struct sk_buff

[PATCH 2/2] neigh: make strucrt neigh_table::entry_size unsigned int

2017-09-23 Thread Alexey Dobriyan
t_get 11041103 -1 __pneigh_lookup 69 68 -1 __neigh_create 24522451 -1 Signed-off-by: Alexey Dobriyan --- drivers/net/ethernet/chelsio/cxgb4/l2t.c |4 ++-- includ

[PATCH 1/2] neigh: make struct neigh_table::entry_size unsigned int

2017-09-23 Thread Alexey Dobriyan
_iter152 151 -1 clip_ioctl 14751474 -1 clip_constructor 93 92 -1 __neigh_create 24552452 -3 Signed-off-by: Alexey Dobriyan --- in

[PATCH 5/5] xfrm: eradicate size_t

2017-09-21 Thread Alexey Dobriyan
ate unsignedness and flip some "int" to "unsigned int" as well. This is preparation to switching nlmsg_new() to "unsigned int". Signed-off-by: Alexey Dobriyan --- net/xfrm/xfrm_user.c | 44 +++- 1 file changed, 23 insertions(+

[PATCH 4/5] xfrm: make xfrm_replay_state_esn_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
y_esn 349 337 -12 xfrm_replay_notify_bmp 345 333 -12 Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) --- a/include/net/xfrm.h +++ b/includ

[PATCH 2/5] xfrm: make xfrm_alg_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
Key lengths can't be negative. Comparison with nla_len() is left signed just in case negative value can sneak in there. Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/include/net/x

[PATCH 3/5] xfrm: make xfrm_alg_auth_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
Key lengths can't be negative. Comparison with nla_len() is left signed just in case negative value can sneak in there. Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/include/net/x

[PATCH 1/5] xfrm: make aead_len() return unsigned int

2017-09-21 Thread Alexey Dobriyan
Key lengths can't be negative. Comparison with nla_len() is left signed just in case negative value can sneak in there. Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |2 +- net/xfrm/xfrm_user.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/include/net/x

[PATCH] net: use 32-bit arithmetic while allocating net device

2017-09-21 Thread Alexey Dobriyan
-off-by: Alexey Dobriyan --- net/core/dev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -7989,7 +7989,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, unsigned int txqs, unsigned int rxqs

Re: [PATCH] net: Convert int functions to bool

2017-09-13 Thread Alexey Dobriyan
> Global function ipv6_rcv_saddr_equal and static functions > ipv6_rcv_saddr_equal and ipv4_rcv_saddr_equal currently return int. > > bool is slightly more descriptive for these functions so change > their return type from int to bool. >From code generation POV "int" is better for non-inlined func

Re: [patch net-next 1/3] idr: Use unsigned long instead of int

2017-08-16 Thread Alexey Dobriyan
[CC trimmed] On Tue, Aug 15, 2017 at 10:12:16PM -0400, Chris Mi wrote: > IDR uses internally radix tree which uses unsigned long. It doesn't > makes sense to have index as signed value. It doesn't. But it makes sense to use "unsigned int" because it generates smaller code on x86_64.

Re: [PATCH net-next] net: ndisc.c: reduce size of __ndisc_fill_addr_option()

2017-05-27 Thread Alexey Dobriyan
> --- a/net/ipv6/ndisc.c > +++ b/net/ipv6/ndisc.c > @@ -148,17 +148,18 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int > type, void *data, > space -= data_len; > - if (space > 0) > - memset(opt, 0, space); > + > + memset(opt, 0, space); This can't be right. A

[PATCH] net: make struct request_sock_ops::obj_size unsigned

2017-05-22 Thread Alexey Dobriyan
This field is sizeof of corresponding kmem_cache so it can't be negative. Space will be saved after 32-bit kmem_cache_create() patch. Signed-off-by: Alexey Dobriyan --- include/net/request_sock.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/request_sock.h

[PATCH net-next] net: make struct inet_frags::qsize unsigned

2017-05-22 Thread Alexey Dobriyan
This field is sizeof of corresponding kmem_cache so it can't be negative. Prepare for 32-bit kmem_cache_create(). Signed-off-by: Alexey Dobriyan --- include/net/inet_frag.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/net/inet_frag.h +++ b/include/net/inet_f

[PATCH net-next] net: make struct dst_entry::dev first member

2017-05-17 Thread Alexey Dobriyan
30523045 -7 callforward_do_filter659 651 -8 dst_gc_task 571 549 -22 Signed-off-by: Alexey Dobriyan --- include/net/dst.h |2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH net-next] net: make struct net_device::tx_queue_len unsigned int

2017-05-17 Thread Alexey Dobriyan
810 799 -11 transmit 719 698 -21 Signed-off-by: Alexey Dobriyan --- drivers/net/wan/hdlc_raw_eth.c |3 ++- include/linux/netdevice.h |2 +- net/core/net-sysfs.c |8 ++-- net/core/rtnetlink.c

Re: [PATCH] net: move padding in struct skb_shared_info

2017-04-11 Thread Alexey Dobriyan
On Mon, Apr 10, 2017 at 5:43 PM, Eric Dumazet wrote: > On Mon, 2017-04-10 at 11:07 +0300, Alexey Dobriyan wrote: >> struct skb_shared_info { >> - unsigned short _unused; >> unsigned char nr_frags; >> __u8tx_flags; >> u

[PATCH] net: make struct net_device::min_header_len 8-bit

2017-04-10 Thread Alexey Dobriyan
169 164 -5 ether_setup 148 143 -5 Signed-off-by: Alexey Dobriyan --- include/linux/netdevice.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h

[PATCH] net: neigh: make ->hh_len 32-bit

2017-04-10 Thread Alexey Dobriyan
h_output 14131409 -4 ip_finish_output2 16271623 -4 Signed-off-by: Alexey Dobriyan --- include/linux/netdevice.h |3 +-- include/net/neighbour.h |4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) --- a

[PATCH] net: move padding in struct skb_shared_info

2017-04-10 Thread Alexey Dobriyan
ned-off-by: Alexey Dobriyan --- include/linux/skbuff.h |1 - 1 file changed, 1 deletion(-) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -413,7 +413,6 @@ struct ubuf_info { * the end of the header data, ie. at skb->end. */ struct skb_shared_info { - unsigned s

Re: [PATCH net-next 0/1 v2] skbuff: Extend gso_type to unsigned int.

2017-04-09 Thread Alexey Dobriyan
> struct skb_shared_info { > + unsigned short _unused; > unsigned char nr_frags; This makes _all_ fields to be accessed with offset, but if you move padding down, at least ->nr_frags will enjoy clean and simple [R64] addressing. On allyesconfig-ish kernel: before: +542 = 72

Re: [PATCH] soreuseport: use "unsigned int" in __reuseport_alloc()

2017-04-04 Thread Alexey Dobriyan
On Mon, Apr 3, 2017 at 4:56 PM, Craig Gallek wrote: > On Sun, Apr 2, 2017 at 6:18 PM, Alexey Dobriyan wrote: >> Number of sockets is limited by 16-bit, so 64-bit allocation will never >> happen. >> >> 16-bit ops are the worst code density-wise on x86_64 because of >

[PATCH] soreuseport: use "unsigned int" in __reuseport_alloc()

2017-04-02 Thread Alexey Dobriyan
old new delta reuseport_add_sock 539 536 -3 Signed-off-by: Alexey Dobriyan --- net/core/sock_reuseport.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/sock_reuseport.c +++ b/net/core/sock_reuseport.c @@ -13,9 +13,9

[PATCH v2 3/3] flowcache: more "unsigned int"

2017-04-02 Thread Alexey Dobriyan
Make ->hash_count, ->low_watermark and ->high_watermark unsigned int and propagate unsignedness to other variables. This change doesn't change code generation because these fields aren't used in 64-bit contexts but make it anyway: these fields can't be negative numbers

[PATCH v2 2/3] flowcache: make flow_cache_hash_size() return "unsigned int"

2017-04-02 Thread Alexey Dobriyan
flow_cache_flush_tasklet 362 365 +3 __flow_cache_shrink 333 336 +3 flow_cache_cpu_up_prep 178 171 -7 flow_cache_lookup 11591148 -11 Signed-off-by: A

[PATCH v2 1/3] flowcache: make flow_key_size() return "unsigned int"

2017-04-02 Thread Alexey Dobriyan
che_lookup 11631159 -4 CSWTCH 75997 75953 -44 Signed-off-by: Alexey Dobriyan --- include/net/flow.h |2 +- net/core/flow.c|6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/net/flow.h +++ b/include/

Re: [PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-27 Thread Alexey Dobriyan
On Mon, Mar 27, 2017 at 1:37 PM, Steffen Klassert wrote: > On Sat, Mar 25, 2017 at 07:41:17PM +0300, Alexey Dobriyan wrote: >> After (no branches): >> >> movr8d,0x20 >> movrdx,0x >> movesi,DWORD PTR [rsi+0x2c] >

[PATCH v2] xfrm: branchless addr4_match() on 64-bit

2017-03-25 Thread Alexey Dobriyan
esi,DWORD PTR [rbx] movrdi,rdx xoreax,eax shlrdi,cl bswap edi Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -845,9 +845,9 @@

Re: [PATCH] xfrm: branchless addr4_match() on 64-bit

2017-03-25 Thread Alexey Dobriyan
On Fri, Mar 24, 2017 at 05:16:44PM +, David Laight wrote: > From: Alexey Dobriyan > > Sent: 23 March 2017 23:33 > > Current addr4_match() code has special test for /0 prefixes because of > > standard required undefined behaviour. However, it is possible to omit >

[PATCH] xfrm: branchless addr4_match() on 64-bit

2017-03-23 Thread Alexey Dobriyan
,DWORD PTR [rbx] movrdi,rdx xoreax,eax shlrdi,cl bswap edi Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |5 + 1 file changed, 5 insertions(+) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -844,10 +844,15 @@ static inlin

[PATCH] xfrm: use "unsigned int" in addr_match()

2017-03-23 Thread Alexey Dobriyan
xfrm_state_walk 708 696 -12 xfrm_selector_match 918 906 -12 Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/include/net/xfrm.h +++

[PATCH] xfrm: use "unsigned int" in __xfrm6_pref_hash()

2017-03-23 Thread Alexey Dobriyan
xfrm_hash_resize27522743 -9 policy_hash_bysel985 973 -12 policy_hash_direct 1036 999 -37 Signed-off-by: Alexey Dobriyan --- net/xfrm/xfrm_hash.h |4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH] xfrm: remove unused struct xfrm_mgr::id

2017-03-23 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan --- include/net/xfrm.h |1 - net/key/af_key.c |1 - net/xfrm/xfrm_user.c |1 - 3 files changed, 3 deletions(-) --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -586,7 +586,6 @@ struct xfrm_migrate { struct xfrm_mgr { struct

[PATCH] net: make in_aton() 32-bit internally

2017-03-23 Thread Alexey Dobriyan
Converting IPv4 address doesn't need 64-bit arithmetic. Space savings: 10 bytes! add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10) function old new delta in_aton96 86 -10 Signed-off-by: A

Re: [PATCH 3/4] flowcache: make struct flow_cache_percpu::hash_rnd_recalc bool

2017-03-22 Thread Alexey Dobriyan
On Wed, Mar 22, 2017 at 5:09 AM, David Miller wrote: > From: Alexey Dobriyan > Date: Mon, 20 Mar 2017 01:27:43 +0300 > >> ->hash_rnd_recalc is only used in boolean context. >> >> Space savings on x86_64 come from the fact that "MOV rm8, imm8" is >>

Re: [PATCH 2/4] flowcache: make flow_cache_hash_size() return "unsigned int"

2017-03-19 Thread Alexey Dobriyan
On Sun, Mar 19, 2017 at 04:13:41PM -0700, Eric Dumazet wrote: > On Mon, 2017-03-20 at 01:24 +0300, Alexey Dobriyan wrote: > > Hash size can't negative so "unsigned int" is logically correct. > > > > struct flow_cache_percpu *fcp = per_cpu_ptr(fc->p

[PATCH 4/4] flowcache: more "unsigned int" in struct flow_cache_percpu

2017-03-19 Thread Alexey Dobriyan
Make ->hash_count, ->low_watermark and ->high_watermark unsigned int and propagate unsignedness to other variables. This doesn't change code generation because these fields aren't used in 64-bit contexts but make it anyway: these fields can't be negative numbers. Signed

[PATCH 3/4] flowcache: make struct flow_cache_percpu::hash_rnd_recalc bool

2017-03-19 Thread Alexey Dobriyan
chg -0.00% Signed-off-by: Alexey Dobriyan --- include/net/flowcache.h |2 +- net/core/flow.c |6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/net/flowcache.h +++ b/include/net/flowcache.h @@ -10,7 +10,7 @@ struct flow_cache_percpu {

[PATCH 2/4] flowcache: make flow_cache_hash_size() return "unsigned int"

2017-03-19 Thread Alexey Dobriyan
: Before=170822884, After=170822872, chg -0.00% Lookup becomes smaller and this is what matters. Signed-off-by: Alexey Dobriyan --- net/core/flow.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) --- a/net/core/flow.c +++ b/net/core/flow.c @@ -47,7 +47,7 @@ struct flow_flus

[PATCH 1/4] flowcache: make flow_key_size() return "unsigned int"

2017-03-19 Thread Alexey Dobriyan
che_lookup 11631159 -4 CSWTCH 75553 75509 -44 Total: Before=170822932, After=170822884, chg -0.00% Signed-off-by: Alexey Dobriyan --- include/net/flow.h |2 +- net/core/flow.c|6 +++--- 2 files changed, 4 insert

Re: [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add()

2017-01-26 Thread Alexey Dobriyan
On Thu, Jan 26, 2017 at 1:18 PM, SF Markus Elfring wrote: > - pctx = kmalloc(sizeof(struct pdp_ctx), GFP_KERNEL); > + pctx = kmalloc(sizeof(*pctx), GFP_KERNEL); The rule about "sizeof(*p)" style of allocation is bogus and should be abolished. Rationale says that > The alternati

Re: [PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-14 Thread Alexey Dobriyan
On Tue, Dec 13, 2016 at 5:42 PM, David Laight wrote: > From: Alexey Dobriyan >> Sent: 13 December 2016 14:23 > ... >> Well, the point of the patch is to save .text, so might as well save >> as much as possible. Any form other than "ptr[id]" is going >> to b

[PATCH net-next] netlink: revert broken, broken "2-clause nla_ok()"

2016-12-13 Thread Alexey Dobriyan
Commit 4f7df337fe79bba1e4c2d525525d63b5ba186bbd "netlink: 2-clause nla_ok()" is BROKEN. First clause tests if "->nla_len" could even be accessed at all, it can not possibly be omitted. Signed-off-by: Alexey Dobriyan --- include/net/netlink.h |3 ++- 1 file chan

Re: [PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-13 Thread Alexey Dobriyan
On Wed, Dec 7, 2016 at 1:49 PM, David Laight wrote: > From: Alexey Dobriyan >> Sent: 05 December 2016 14:48 >> On Mon, Dec 5, 2016 at 3:49 PM, David Laight wrote: >> > From: Alexey Dobriyan >> >> Sent: 02 December 2016 01:22 >> >> net_generic() f

BROKEN Re: [PATCH] netlink: 2-clause nla_ok()

2016-12-05 Thread Alexey Dobriyan
nla->nla_len >= sizeof(*nla) && nla->nla_len <= remaining; Those logical ands ensure that memory access is not done if "rem" is small enough to even fetch ->nla_len. Maybe someone could vouch that other checks prevent this kind of situation from happening but not me. How very embarrassing. Signed-off-by: Alexey Dobriyan

Re: [PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-05 Thread Alexey Dobriyan
On Mon, Dec 5, 2016 at 3:49 PM, David Laight wrote: > From: Alexey Dobriyan >> Sent: 02 December 2016 01:22 >> net_generic() function is both a) inline and b) used ~600 times. >> >> It has the following code inside >> >>

[PATCH 3/3] netns: fix net_generic() "id - 1" bloat

2016-12-01 Thread Alexey Dobriyan
nfsd4_lock 38513796 -55 tipc_mon_rcv1012 956 -56 Total: Before=156643951, After=156639743, chg -0.00% Signed-off-by: Alexey Dobriyan --- include/net/netns/generic.h | 16

[PATCH] netlink: 2-clause nla_ok()

2016-12-01 Thread Alexey Dobriyan
6 -82 nl80211_parse_sched_scan28892780-109 ip_tun_from_nlattr 30862945-141 Signed-off-by: Alexey Dobriyan --- include/net/netlink.h |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/include/net/netlink.h +++ b/includ

[PATCH 2/3] netns: add dummy struct inside "struct net_generic"

2016-12-01 Thread Alexey Dobriyan
This is precursor to fixing "[id - 1]" bloat inside net_generic(). Name "s" is chosen to complement name "u" often used for dummy unions. Signed-off-by: Alexey Dobriyan --- include/net/netns/generic.h |6 -- net/core/net_namespace.c|8

[PATCH 1/3] netns: publish net_generic correctly

2016-12-01 Thread Alexey Dobriyan
ult is to preallocate 13 pointers which is actually quite a lot. You need IPv6, netfilter, bridging etc together loaded to trigger reallocation in the first place. Trimmed down config are OK. Signed-off-by: Alexey Dobriyan --- net/core/net_namespace.c | 10 +- 1 file cha

Re: [PATCH] net: fix bogus cast in skb_pagelen() and use unsigned variables

2016-11-23 Thread Alexey Dobriyan
On Wed, Nov 23, 2016 at 3:49 PM, David Laight wrote: > From: Alexey Dobriyan >> Sent: 19 November 2016 01:08 > ... >> - for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) >> + for (i = skb_shinfo(skb)->nr_frags - 1; (int)i >= 0; i--) &

[PATCH] net: fix bogus cast in skb_pagelen() and use unsigned variables

2016-11-18 Thread Alexey Dobriyan
-1 ip_do_fragment 25492548 -1 ip6_fragment31303128 -2 Total: Before=154865032, After=154865028, chg -0.00% Signed-off-by: Alexey Dobriyan --- include/linux/skbuff.h |6 +++--- net/ipv4/ip_

[PATCH] netlink: smaller nla_attr_minlen table

2016-11-18 Thread Alexey Dobriyan
Total: Before=154865051, After=154865032, chg -0.00% Signed-off-by: Alexey Dobriyan --- lib/nlattr.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -14,7 +14,7 @@ #include #include -static const u16 nla_attr_minlen[NLA_TYPE_MAX+1

[PATCH] netlink: use "unsigned int" in nla_next()

2016-11-18 Thread Alexey Dobriyan
721659 -13 nl80211_parse_sched_scan29022888 -14 nl80211_trigger_scan17381720 -18 do_execute_actions 28212738 -83 Total: Before=154865355, After=154865051, chg -0.00% Signed-off-b

[PATCH] net: make struct napi_alloc_cache::skb_count unsigned int

2016-11-18 Thread Alexey Dobriyan
__kfree_skb_flush 56 53 -3 __kfree_skb_defer 97 92 -5 Total: Before=154865639, After=154865629, chg -0.00% Signed-off-by: Alexey Dobriyan --- net/core/skbuff.c |2 +- 1 file changed, 1 insertion

  1   2   3   >