All of lore.kernel.org
 help / color / mirror / Atom feed
* [LIST] large local declarations
@ 2002-11-21 21:54 dan carpenter
  2002-11-22  6:25 ` Roland Dreier
  2002-11-22  7:04 ` SL Baur
  0 siblings, 2 replies; 5+ messages in thread
From: dan carpenter @ 2002-11-21 21:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: smatch-kbugs, kernel-janitor-discuss

I have a smatch script (smatch.sf.net) that finds the the size of local variables.  I created an allyesconfig with 2.5.48 and tested it.  These were the functions that declared local datas with size of 5 digits or more (in bits).  Some of them should probably be changed to declare a pointer then use kmalloc() and free().

if (foo) {
        int frob[HUGE_NUM];
        ...
} else {
        int bar[HUGE_NUM];
        ...
}
This would not count against you twice, since the script takes code paths into consideration.

The function with the largest variable is riocontrol().  It is used deliberately for some weird hardware.  According to the comment, "it's hardware like this that really gets on [the author's] tits."

regards,
dan carpenter

size     file lineno function
16768	 drivers/atm/iphase.c 2874 ia_ioctl
11104	 drivers/block/cpqarray.c 1090 ida_ioctl
21248	 drivers/cdrom/optcd.c 1623 cdromread
524736	 drivers/char/rio/rioctrl.c 1784 riocontrol
15968	 drivers/ide/ide.c 1893 ide_unregister
16448	 drivers/isdn/i4l/isdn_common.c 1271 isdn_statstr
12320	 drivers/media/video/meye.c 400 jpeg_quantisation_tables
16552	 drivers/media/video/w9966.c 911 w9966_v4l_read
16584	 drivers/message/i2o/i2o_proc.c 1094 i2o_proc_read_groups
16640	 drivers/message/i2o/i2o_proc.c 2295 i2o_proc_read_lan_mcast_addr
16640	 drivers/message/i2o/i2o_proc.c 2525 i2o_proc_read_lan_alt_addr
23072	 drivers/message/i2o/i2o_proc.c 889 i2o_proc_read_ddm_table
12224	 drivers/mtd/chips/amd_flash.c 751 amd_flash_probe
35744	 drivers/net/e100/e100_main.c 2812 e100_load_microcode
16496	 drivers/net/wireless/airo.c 5949 readrids
16640	 drivers/net/wireless/airo.c 6041 writerids
32896	 drivers/scsi/53c700.c 1752 NCR_700_proc_directory_info
11744	 drivers/scsi/aic7xxx_old.c 11156 aic7xxx_print_card
16824	 drivers/scsi/cpqfcTScontrol.c 1630 CpqTsProcessIMQEntry
16496	 drivers/scsi/cpqfcTScontrol.c 648 PeekIMQEntry
24800	 drivers/scsi/qlogicfc.c 937 isp2x00_make_portdb
25808	 drivers/usb/media/ibmcam.c 3480 ibmcam_model3_setup_after_video_if
16280	 drivers/usb/media/ibmcam.c 638 ibmcam_parse_lines
16160	 drivers/usb/media/ibmcam.c 945 ibmcam_model3_parse_lines
11104	 fs/cifs/smbdes.c 270 dohash
33056	 fs/intermezzo/journal.c 1281 presto_copy_kml_tail
33344	 fs/intermezzo/journal.c 1633 presto_get_fileid
16512	 fs/nfsd/nfsctl.c 214 write_export
16512	 fs/nfsd/nfsctl.c 224 write_unexport
10336	 fs/xfs/xfs_da_btree.c 599 xfs_da_node_rebalance
27104	 fs/xfs/xfs_dir_leaf.c 763 xfs_dir_leaf_to_node
12480	 fs/xfs/xfs_fsops.c 381 xfs_growfs_data_private
11552	 lib/inflate.c 488 huft_build
10560	 lib/inflate.c 906 inflate_dynamic
10336	 net/wanrouter/wanmain.c 776 device_new_if
11360	 sound/core/oss/pcm_oss.c 453 snd_pcm_oss_change_params
16864	 sound/pci/emu10k1/emufx.c 2283 snd_emu10k1_fx8010_ioctl


The script used to generate the data:
#!/usr/bin/perl -w

use smatch;
my $max = 0;

sub merge_rules($$){
    my $one = shift;
    my $two = shift;
    if (int($one) > int($two)){
	return $one;
    }else{
	return $two;
    }
}

while ($data = get_data()){

    if ($data =~ /func_impl/){
	$max = 0;
    }
    if ($data =~ /end_func/){
	print get_filename(), " ", get_lineno(), " ", get_cur_func(), " $max\n";
    }

    if ($data =~ /decl_size\(integer_cst\((\d+)\)\)/){
	set_state("total", get_state("total")+$1);
	if ($max < get_state("total")){
	    $max = get_state("total");
	}
    }
}


-- 
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [LIST] large local declarations
@ 2002-11-22  7:41 dan carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: dan carpenter @ 2002-11-22  7:41 UTC (permalink / raw)
  To: steve; +Cc: linux-kernel, smatch-kbugs, kernel-janitor-discuss

From: SL Baur <steve@kbuxd.necst.nec.co.jp>

> dan carpenter writes:
> > The function with the largest variable is riocontrol().  It is used
> > deliberately for some weird hardware.  According to the comment,
> > "it's hardware like this that really gets on [the author's] tits."
> 
> > 524736	 drivers/char/rio/rioctrl.c 1784 riocontrol
> 
> That variable is static.
> 

Ah...  I did not know that matterred.
Probably a lot of the other variables on the list are as well.

It will take me a couple days to create a new list that takes
static variables into consideration.

regards,
dan carpenter


-- 
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

One click access to the Top Search Engines
http://www.exactsearchbar.com/mailcom


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-11-22  7:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-21 21:54 [LIST] large local declarations dan carpenter
2002-11-22  6:25 ` Roland Dreier
2002-11-22  6:49   ` Randy.Dunlap
2002-11-22  7:04 ` SL Baur
  -- strict thread matches above, loose matches on Subject: below --
2002-11-22  7:41 dan carpenter

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.