linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: 2.5.70-bk4+: oops by mc -v /proc/bus/pci/00/00.0
       [not found] ` <20030531195414.10c957b7.akpm@digeo.com>
@ 2003-06-01 12:34   ` Ingo Oeser
  2003-06-01 19:58     ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Oeser @ 2003-06-01 12:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm

Hi Andrew,

On Sat, May 31, 2003 at 07:54:14PM -0700, Andrew Morton wrote:
> It's pretty lame.  Really we need a proper vma constructor
> somewhere.

you mean sth. like this? (Just initialized the members, that I had useful
defaults for.)

--- linux-2.5.70/kernel/fork.c	Sun Jun  1 13:08:54 2003
+++ linux-2.5.70/kernel/fork.c	Sun Jun  1 14:26:19 2003
@@ -1147,6 +1147,35 @@
 /* SLAB cache for mm_struct structures (tsk->mm) */
 kmem_cache_t *mm_cachep;
 
+/* SLAB constructor for vm_area_struct objects */
+static void init_vm_area_struct(void *at, kmem_cache_t * dummy, 
+		unsigned long flags) 
+{
+	        struct vm_area_struct *t = at;
+
+		if (SLAB_CTOR_CONSTRUCTOR != 
+			(flags & (SLAB_CTOR_CONSTRUCTOR | SLAB_CTOR_VERIFY) ))
+			return;
+
+		/* these are NOT initialized, because they must be intialized
+		 * by the caller of kmem_cache_alloc():
+
+			t->vm_mm
+			t->vm_start
+			t->vm_end
+			t->vm_page_prot
+			t->vm_flags
+			t->vm_rb
+
+		*/
+		t->vm_next = NULL;
+		INIT_LIST_HEAD(&t->shared);
+		t->vm_ops = NULL;
+		t->vm_pgoff = 0; /* FIXME: maybe ~0UL is better here? */
+		t->vm_file = NULL;
+		t->private_data = NULL;
+}
+
 void __init proc_caches_init(void)
 {
 	sighand_cachep = kmem_cache_create("sighand_cache",
@@ -1175,7 +1204,7 @@
  
 	vm_area_cachep = kmem_cache_create("vm_area_struct",
 			sizeof(struct vm_area_struct), 0,
-			0, NULL, NULL);
+			0, init_vm_area_struct, NULL);
 	if(!vm_area_cachep)
 		panic("vma_init: Cannot alloc vm_area_struct SLAB cache");
 

Regards

Ingo Oeser
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: 2.5.70-bk4+: oops by mc -v /proc/bus/pci/00/00.0
  2003-06-01 12:34   ` 2.5.70-bk4+: oops by mc -v /proc/bus/pci/00/00.0 Ingo Oeser
@ 2003-06-01 19:58     ` Andrew Morton
  2003-06-01 21:53       ` William Lee Irwin III
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-06-01 19:58 UTC (permalink / raw)
  To: Ingo Oeser; +Cc: linux-mm

Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de> wrote:
>
> Hi Andrew,
> 
> On Sat, May 31, 2003 at 07:54:14PM -0700, Andrew Morton wrote:
> > It's pretty lame.  Really we need a proper vma constructor
> > somewhere.
> 
> you mean sth. like this? (Just initialized the members, that I had useful
> defaults for.)
> 
> ...
>  	vm_area_cachep = kmem_cache_create("vm_area_struct",
>  			sizeof(struct vm_area_struct), 0,
> -			0, NULL, NULL);
> +			0, init_vm_area_struct, NULL);
>  	if(!vm_area_cachep)
>  		panic("vma_init: Cannot alloc vm_area_struct SLAB cache");
>  

Well not really.  Yes, a slab-based ctor would be nice, but it requires that
all objects be kfreed in a "constructed" state.  So a full audit/fixup of
all users is needed.

For now I was thinking more along the lines of

struct vma_struct alloc_vma(gfp_flags)
{
	vma = kmem_cache_alloc();
	memset(vma);
	return vma;
}

And then deleting tons of open-coded init stuff elsewhere...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

* Re: 2.5.70-bk4+: oops by mc -v /proc/bus/pci/00/00.0
  2003-06-01 19:58     ` Andrew Morton
@ 2003-06-01 21:53       ` William Lee Irwin III
  0 siblings, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2003-06-01 21:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ingo Oeser, linux-mm

On Sun, Jun 01, 2003 at 12:58:09PM -0700, Andrew Morton wrote:
> Well not really.  Yes, a slab-based ctor would be nice, but it requires that
> all objects be kfreed in a "constructed" state.  So a full audit/fixup of
> all users is needed.
> For now I was thinking more along the lines of
> struct vma_struct alloc_vma(gfp_flags)
> {
> 	vma = kmem_cache_alloc();
> 	memset(vma);
> 	return vma;
> }
> And then deleting tons of open-coded init stuff elsewhere...

I'll add vma ctor bits to my TODO list, behind numerous other things..


-- wli
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

end of thread, other threads:[~2003-06-01 21:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20030531165523.GA18067@steel.home>
     [not found] ` <20030531195414.10c957b7.akpm@digeo.com>
2003-06-01 12:34   ` 2.5.70-bk4+: oops by mc -v /proc/bus/pci/00/00.0 Ingo Oeser
2003-06-01 19:58     ` Andrew Morton
2003-06-01 21:53       ` William Lee Irwin III

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