[LU-8196] class_handle_init alloates 1.5M Created: 23/May/16  Updated: 14/Jun/16  Resolved: 14/Jun/16

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.9.0

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: Bob Glossman (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

I got this warning on startup from rhel7 kernel (possible due to debug too, I guess):

May 23 19:43:15 centos6-0 kernel: ------------[ cut here ]------------
May 23 19:43:15 centos6-0 kernel: WARNING: at include/linux/slab_def.h:131 class_handle_init+0x2d6/0x4b0 [obdclass]()
May 23 19:43:15 centos6-0 kernel: Modules linked in: obdclass(OE+) ksocklnd(OE) lnet(OE) sha512_generic crypto_null libcfs(OE) rpcsec_gss_krb5 syscopyarea sysfillrect sysimgblt ttm ata_generic drm_kms_helper pata_acpi drm ata_piix i2c_piix4 virtio_console serio_raw virtio_balloon pcspkr i2c_core virtio_blk libata floppy nfsd ip_tables
May 23 19:43:15 centos6-0 kernel: CPU: 1 PID: 2911 Comm: insmod Tainted: G           OE  ------------   3.10.0-debug #1
May 23 19:43:15 centos6-0 kernel: Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
May 23 19:43:15 centos6-0 kernel: 0000000000000000 00000000b0550638 ffff8800b07a7c50 ffffffff816fe7c0
May 23 19:43:15 centos6-0 kernel: ffff8800b07a7c88 ffffffff810773e0 ffffffff81c15020 ffff8800a9675940
May 23 19:43:15 centos6-0 kernel: ffffffffa04ef000 0000000000000000 ffffffffa03ad120 ffff8800b07a7c98
May 23 19:43:15 centos6-0 kernel: Call Trace:
May 23 19:43:15 centos6-0 kernel: [<ffffffff816fe7c0>] dump_stack+0x19/0x1b
May 23 19:43:15 centos6-0 kernel: [<ffffffff810773e0>] warn_slowpath_common+0x70/0xb0
May 23 19:43:15 centos6-0 kernel: [<ffffffffa04ef000>] ? 0xffffffffa04eefff
May 23 19:43:15 centos6-0 kernel: [<ffffffff8107752a>] warn_slowpath_null+0x1a/0x20
May 23 19:43:15 centos6-0 kernel: [<ffffffffa03278b6>] class_handle_init+0x2d6/0x4b0 [obdclass]
May 23 19:43:15 centos6-0 kernel: [<ffffffffa04ef000>] ? 0xffffffffa04eefff
May 23 19:43:15 centos6-0 kernel: [<ffffffffa04ef522>] obdclass_init+0x522/0x1000 [obdclass]
May 23 19:43:15 centos6-0 kernel: [<ffffffffa04ef000>] ? 0xffffffffa04eefff
May 23 19:43:15 centos6-0 kernel: [<ffffffff810020e8>] do_one_initcall+0xb8/0x230
May 23 19:43:15 centos6-0 kernel: [<ffffffff810f3e6e>] load_module+0x138e/0x1bc0
May 23 19:43:15 centos6-0 kernel: [<ffffffff8139de20>] ? ddebug_proc_write+0xf0/0xf0
May 23 19:43:15 centos6-0 kernel: [<ffffffff810eff23>] ? copy_module_from_fd.isra.40+0x53/0x150
May 23 19:43:15 centos6-0 kernel: [<ffffffff810f4876>] SyS_finit_module+0xa6/0xd0
May 23 19:43:15 centos6-0 kernel: [<ffffffff81711809>] system_call_fastpath+0x16/0x1b
May 23 19:43:15 centos6-0 kernel: ---[ end trace 3075995fdee801fd ]---

given that smatch complains about

/home/green/smt/git/lustre-release/lustre/obdclass/lustre_handles.c:261:9: warning: memset with byte count of 1572864

That must be it.
We probably should convert OBD_ALLOC_LARGE to go straight to vmalloc for >128k allocations as opposed to malloc fist since in rhel7 and probably other places it generates a warning:

0x308b0 is in class_handle_init (include/linux/slab_def.h:131).
126			int i;
127	
128			if (!size)
129				return ZERO_SIZE_PTR;
130	
131			if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
132				return NULL;
133	
134			i = kmalloc_index(size);
135	


 Comments   
Comment by Peter Jones [ 24/May/16 ]

Bob

Could you please address this issue?

Thanks

Peter

Comment by Andreas Dilger [ 24/May/16 ]

OBD_ALLOC_LARGE() should check against KMALLOC_MAX_SIZE, not 128KB.

Comment by Gerrit Updater [ 24/May/16 ]

Bob Glossman (bob.glossman@intel.com) uploaded a new patch: http://review.whamcloud.com/20420
Subject: LU-8196 obd: force very large allocations to use vmalloc
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8caca1cb3e864f111acb562a49683d3da3baeb9c

Comment by Gerrit Updater [ 14/Jun/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/20420/
Subject: LU-8196 obd: force very large allocations to use vmalloc
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 5b8749c4669e93dcafebc4c93aa1974c96ff43c7

Comment by Joseph Gmitter (Inactive) [ 14/Jun/16 ]

patch has landed to master for 2.9

Generated at Sat Feb 10 02:15:28 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.