2004-09-18 13:57:42

by Denis Vlasenko

[permalink] [raw]
Subject: [PATCH] trivial patch for 2.4: always inline __constant_*

> > 2.4:
> >
> > 2994 total 0.0013
> > 620 link_path_walk 0.2892
> > 285 d_lookup 1.2076
> > 156 dput 0.4815
> > 118 kmem_cache_free 0.7564
> > 109 system_call 1.9464
> > 106 kmem_cache_alloc 0.5096
> > 103 strncpy_from_user 1.2875
> > 97 open_namei 0.0767
> > 92 fput 0.3710
> > 88 get_unused_fd 0.2529
> > 85 vfs_permission 0.3320
> > 79 page_follow_link 0.2264
> > 79 __constant_c_and_count_memset 0.6583
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Someone broke inlining in 2.4 *again*.
> I bet System.map have dozens of __constant_c_and_count_memset's

This is how to find wrongly de-inlined finctions:

a) Find duplicate names:

# cat System.map | cut -d ' ' -f3 | sort | uniq -c | grep -vF $' 1\t' | sort -r

41 version
21 debug
14 options
14 mdio_write
14 mdio_read
14 max_interrupt_work
14 SysKonnectFileId
13 rx_copybreak
13 full_duplex
12 version_printed.0
12 set_rx_mode
12 set_multicast_list
12 buf.0
12 __constant_c_and_count_memset
10 read_eeprom
10 printed_version.1
10 multicast_filter_limit
10 .text.lock.inode
9 netdev_ioctl
7 netdev_get_drvinfo
7 netdev_ethtool_ops
7 netdev_ethtool_ioctl
7 mtu
7 get_stats
7 card_idx.0
6 parse_options
6 netdev_set_msglevel
6 netdev_get_msglevel
6 devfs_handle
6 __constant_memcpy
5 netcard_portlist
5 driver
4 tx_timeout
4 start_tx
4 netdev_open
4 netdev_close
4 net_debug
4 media
4 intr_handler
4 init_ring
4 init_once
4 buf.1
3 xdr_error
3 update_stats
3 ports.0
3 pci_id_tbl
3 netdev_timer
3 netdev_set_settings
3 netdev_rx
3 netdev_nway_reset
3 netdev_get_settings
3 netdev_get_link
3 netdev_error
3 hardware_send_packet
3 ethtool_stats_keys
3 __set_rx_mode

Of these, at least the following were intended to be always inlined:

12 __constant_c_and_count_memset
6 __constant_memcpy

Prolly #include <linux/compiler.h> is missing in some files,
or included too late to have desired effect.
Let's find them:

{
find -name '*.o' | xargs grep -lF '__constant_c_and_count_memset'
find -name '*.o' | xargs grep -lF '__constant_memcpy'
} | sort | uniq

./arch/i386/kernel/irq.o
./arch/i386/kernel/kernel.o
./arch/i386/mm/init.o
./arch/i386/mm/mm.o
./drivers/block/block.o
./drivers/block/rd.o
./drivers/char/char.o
./drivers/char/n_tty.o
./drivers/char/tty_io.o
./drivers/parport/parport.o
./drivers/parport/procfs.o
./drivers/scsi/sr_mod.o
./drivers/scsi/sr_vendor.o
./fs/dcache.o
./fs/file_table.o
./fs/fs.o
./fs/hpfs/buffer.o
./fs/hpfs/ea.o
./fs/hpfs/hpfs.o
./fs/hpfs/namei.o
./fs/lockd/lockd.o
./fs/lockd/svcsubs.o
./fs/nfs/nfs.o
./fs/nfs/nfsroot.o
./fs/nfsd/nfsd.o
./fs/nfsd/vfs.o
./fs/open.o
./fs/reiserfs/dir.o
./fs/reiserfs/objectid.o
./fs/reiserfs/reiserfs.o
./net/core/core.o
./net/core/scm.o
./net/ipv4/arp.o
./net/ipv4/ipconfig.o
./net/ipv4/ipv4.o
./net/network.o

Redoing this with allyesconfig revealed some more files.

Most of them can be fixed with a single #include <compiler.h>
in <string.h>. Along the way, I fixed some non-compilation buglets.
I will submit those patches as replies now.
--
vda


Attachments:
(No filename) (3.67 kB)
linux-2.4.27-pre3.string_h.patch (452.00 B)
Download all attachments

2004-09-18 14:03:23

by Denis Vlasenko

[permalink] [raw]
Subject: [PATCH] trivial patch for 2.4: resolve megaraid_info name collision

I'm not sure whether it make sense to compile in
megaraid and megaraid2 at once, but it does not build
without this patch.
--
vda



Attachments:
(No filename) (132.00 B)
linux-2.4.27-pre3.megaraid2.patch (1.36 kB)
Download all attachments

2004-09-18 17:46:46

by Marcelo Tosatti

[permalink] [raw]
Subject: Re: [PATCH] trivial patch for 2.4: resolve megaraid_info name collision

On Sat, Sep 18, 2004 at 05:03:12PM +0300, Denis Vlasenko wrote:
> I'm not sure whether it make sense to compile in
> megaraid and megaraid2 at once,

It doesnt.

> but it does not build without this patch.

Its intentional.




2004-09-18 17:46:48

by Marcelo Tosatti

[permalink] [raw]
Subject: Re: [PATCH] trivial patch for 2.4: always inline __constant_*


Applied, thanks Denis.

> Most of them can be fixed with a single #include <compiler.h>
> in <string.h>. Along the way, I fixed some non-compilation buglets.
> I will submit those patches as replies now.
> --
> vda

> diff -urpN linux-2.4.27-pre3.org/include/linux/string.h linux-2.4.27-pre3.fix/include/linux/string.h
> --- linux-2.4.27-pre3.org/include/linux/string.h Sat Sep 18 16:52:10 2004
> +++ linux-2.4.27-pre3.fix/include/linux/string.h Fri Sep 17 23:19:23 2004
> @@ -7,6 +7,7 @@
>
> #include <linux/types.h> /* for size_t */
> #include <linux/stddef.h> /* for NULL */
> +#include <linux/compiler.h> /* for inline ((always_inline)) */
>
> #ifdef __cplusplus
> extern "C" {