Re: [PATCH 1/2] NOMMU: Set BDI capabilities for /dev/mem and /dev/kmem

From: David Howells
Date: Wed Aug 30 2006 - 05:22:36 EST



Andrew Morton <akpm@xxxxxxxx> wrote:

> Perhaps one could make mem_bdi==NULL if !CONFIG_MMU, for a minor space
> saving.

The problem is that takes the #ifdef-avoidance scheme a step too far. If we
do that, the kernel will crash. Observe the following:

Breakpoint 1, memory_open (inode=0xc0f7da04, filp=0xc09d8ba0) at fs.h:635
635 return MINOR(inode->i_rdev);
(gdb) n
634 {
(gdb)
904 filp->f_mapping->backing_dev_info = &mem_bdi;
(gdb) i sym filp->f_mapping->backing_dev_info
default_backing_dev_info in section .data

Note how the BDI pointer is already set to the default which we then override.
We either need to fill in mem_bdi correctly for MMU or only override the BDI
pointer if !MMU.

Of course, that doesn't touch on the matter of the compiler not letting you do
&NULL, though I assume you meant make &mem_bdi == NULL.

Also, the default BDI is incorrect for /dev/mem and /dev/kmem since it does
not permit shared mappings, so I think we need mem_bdi anyway, though I should
perhaps make it more general, so that it can apply to all mappable chardevs.

David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/