public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] [PATCH] cpuset operations causes Badness at mm/slab.c:777 warning
@ 2007-06-01  7:27 Srinivasa Ds
  2007-06-01 10:50 ` Srinivasa Ds
  0 siblings, 1 reply; 44+ messages in thread
From: Srinivasa Ds @ 2007-06-01  7:27 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Linus Torvalds, Srivatsa Vaddagiri,
	Dinakar Guniguntala, pj, simon.derr, clameter, clameter, rientjes

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]


 When number of tasks assigned to the specified cpuset becomes zero and
if we try to read tasks file, We get this warning on 2.6.22-rc3 kernel.

=======================================================
------------[ cut here ]------------
Badness at mm/slab.c:777
Call Trace:
[c000000071ebb4a0] [c00000000000eb30] .show_stack+0x68/0x1b0 (unreliable)
[c000000071ebb540] [c00000000021d7b0] .report_bug+0x94/0xe8
[c000000071ebb5d0] [c00000000048eb4c] __kprobes_text_start+0x164/0x5a0
[c000000071ebb650] [c000000000004a84] program_check_common+0x104/0x180
--- Exception: 700 at .__kmalloc+0x44/0x178
    LR = .cpuset_tasks_open+0x90/0x1e8
[c000000071ebb940] [c000000071ebb9e0] 0xc000000071ebb9e0 (unreliable)
[c000000071ebb9e0] [c0000000000812b0] .cpuset_tasks_open+0x90/0x1e8
[c000000071ebbaa0] [c0000000000811fc] .cpuset_file_open+0x70/0x94
[c000000071ebbb30] [c0000000000c2578] .__dentry_open+0x13c/0x278
[c000000071ebbbe0] [c0000000000c2828] .do_filp_open+0x50/0x70
[c000000071ebbd00] [c0000000000c28bc] .do_sys_open+0x74/0x130
[c000000071ebbdb0] [c000000000101108] .compat_sys_open+0x24/0x38
[c000000071ebbe30] [c00000000000862c] syscall_exit+0x0/0x40
=====================================================

This is because "npids"(represnets number of pids in that cpuset) in
"cpu_task_open" is zero and it tries allocate 0 bytes through kmalloc.

Below patch fixes this problem. Please let me know your comments on this.

Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>



[-- Attachment #2: cpuset.patch --]
[-- Type: text/x-patch, Size: 669 bytes --]

---
 kernel/cpuset.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux-2.6.22-rc3/kernel/cpuset.c
===================================================================
--- linux-2.6.22-rc3.orig/kernel/cpuset.c
+++ linux-2.6.22-rc3/kernel/cpuset.c
@@ -1741,6 +1741,15 @@ static int cpuset_tasks_open(struct inod
 	 * show up until sometime later on.
 	 */
 	npids = atomic_read(&cs->count);
+	if (!npids) {
+		ctr->buf = kmalloc(2, GFP_KERNEL);
+		if (!ctr->buf)
+			goto err2;
+		ctr->bufsz = snprintf(ctr->buf, 2, " ");
+		file->private_data = ctr;
+		return 0;
+	}
+
 	pidarray = kmalloc(npids * sizeof(pid_t), GFP_KERNEL);
 	if (!pidarray)
 		goto err1;

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

end of thread, other threads:[~2007-06-02  1:25 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01  7:27 [RFC] [PATCH] cpuset operations causes Badness at mm/slab.c:777 warning Srinivasa Ds
2007-06-01 10:50 ` Srinivasa Ds
2007-06-01 18:13   ` Christoph Lameter
2007-06-01 19:11     ` Paul Jackson
2007-06-01 19:18       ` Christoph Lameter
2007-06-01 19:47         ` Paul Jackson
2007-06-01 19:51           ` Christoph Lameter
2007-06-01 20:02             ` Paul Jackson
2007-06-01 20:06               ` Christoph Lameter
2007-06-01 20:19                 ` Paul Jackson
2007-06-01 20:43                   ` Christoph Lameter
2007-06-01 20:54                     ` Paul Jackson
2007-06-01 20:30   ` Jeremy Fitzhardinge
2007-06-01 20:44     ` Paul Jackson
2007-06-01 20:47     ` Christoph Lameter
2007-06-01 20:56       ` Jeremy Fitzhardinge
2007-06-01 20:59       ` Andrew Morton
2007-06-01 21:45         ` Christoph Lameter
2007-06-01 22:16           ` Andrew Morton
2007-06-01 22:20             ` Christoph Lameter
2007-06-01 22:33               ` Andrew Morton
2007-06-01 22:41                 ` Christoph Lameter
2007-06-01 23:00                   ` Linus Torvalds
2007-06-01 23:29                     ` Christoph Lameter
2007-06-01 23:41                       ` Linus Torvalds
2007-06-01 23:46                         ` Christoph Lameter
2007-06-01 23:57                           ` Linus Torvalds
2007-06-02  0:12                             ` Christoph Lameter
2007-06-02  0:16                             ` Andrew Morton
2007-06-02  0:26                               ` Christoph Lameter
2007-06-02  1:04                                 ` Linus Torvalds
2007-06-02  0:46                     ` Jeremy Fitzhardinge
2007-06-02  1:05                     ` Valdis.Kletnieks
2007-06-02  1:24                       ` Christoph Lameter
2007-06-01 23:02                   ` Andrew Morton
2007-06-01 23:16                     ` Christoph Lameter
2007-06-01 23:21                       ` Christoph Lameter
2007-06-01 23:36                       ` Linus Torvalds
2007-06-01 23:42                         ` Christoph Lameter
2007-06-01 23:25                     ` Linus Torvalds
2007-06-02  0:41                   ` Jeremy Fitzhardinge
2007-06-02  0:43             ` Jeremy Fitzhardinge
2007-06-02  0:51               ` Andrew Morton
2007-06-02  0:59                 ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox