Skip to contentSkip to conversation

what's zero_pages for in paging_int

DISCUSSION 胡杨树 4 participants 5 messages Oct 30, 2009

lore
Share & tools
lore

胡杨树

author
#0 lore raw

Hi, guys

In paging_int, after setting up bootmem allocator, why zero page is needed? i cannot see any things usefull resides on that page, something i missing obviously?

thanks
----rocky

---------------------Linux-2.6.30/arch/arm/mm/mmu.c-----------------------

void __init paging_init(struct machine_desc *mdesc)

{
         void *zero_page;

         build_mem_type_table();
         sanity_check_meminfo();
         prepare_page_table();
         bootmem_init();
         devicemaps_init(mdesc);
         kmap_init();/*DF: most embedded system do NOT have any HIGH MEM */
         top_pmd = pmd_off_k(0xffff0000);
 

         /*
          * allocate the zero page.  Note that this always succeeds and
          * returns a zeroed result.
          */
         zero_page = alloc_bootmem_low_pages(PAGE_SIZE);   /* DF: what?s this for? */
         empty_zero_page = virt_to_page(zero_page);
         flush_dcache_page(empty_zero_page);

}

#1 lore raw

Hello, rocky.
Mostly zeropage is needed to catch NULL-dereferencing.

Regards.
-- Dima

2009/10/30 ??? <[email protected]>

Quoted 33 lines

Hi, guys

In paging_int, after setting up bootmem allocator, why zero page is
needed? i cannot see any things usefull resides on that page, something i missing obviously?

thanks
----rocky

---------------------Linux-2.6.30/arch/arm/mm/mmu.c-----------------------

void __init paging_init(struct machine_desc *mdesc)

{
        void *zero_page;

        build_mem_type_table();
        sanity_check_meminfo();
        prepare_page_table();
        bootmem_init();
        devicemaps_init(mdesc);
        kmap_init();/*DF: most embedded system do NOT have any HIGH MEM */
        top_pmd = pmd_off_k(0xffff0000);


        /*
         * allocate the zero page.  Note that this always succeeds and
         * returns a zeroed result.
         */
        zero_page = alloc_bootmem_low_pages(PAGE_SIZE);   /* DF: what?s
this for? */
        empty_zero_page = virt_to_page(zero_page);
        flush_dcache_page(empty_zero_page);
Quoted 6 lines

}
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091030/9e0c3573/attachment.htm>

#2 lore raw
In reply to 胡杨树
Quoted 3 lines · ???

In paging_int, after setting up bootmem allocator, why zero page
is needed? i cannot see any things usefull resides on that page, something i missing obviously?

Please don't post extracts of code which are part of mainline kernels. Just provide a reference to where they are. Most people who will reply to you already have a copy of the kernel source.

The zero page is a page full of zeros, and is used to provide userspace with a write-protected initial BSS segment. When userspace first writes to the BSS segments, a page fault happens, and a replacement writable zero page will be given to the program.

#3 lore raw

Where do we place common Kconfig options between a "few" machine types?

Russell (or others),

We have a few Kconfig options that are shared between different machines. Where do we place these Kconfig options?

It seems like others have placed these options in the arch/arm/Kconfig and then added depends on for their particular machine architectures. This seems quite messy to me as the Kconfigs only apply to a few machines.

Does something like this make sense: place machine specific Kconfig settings in mach-bcmring, mach-bcm1234, mach-bcm5678 and then place the common settings in another Kconfig file in a "mach-bcmcommon" directory.

mach-bcmring/Kconfig
mach-bcm1234/Kconfig
mach-bcm5678/Kconfig
mach-bcmcommon/Kconfig

The problem is mach-bcmcommon is not a machine type but just a place to keep these common settings out of the main arch/arm/Kconfig file. Perhaps it needs a different name?

I don't know what the best solution is right now. Should these "common" Kconfig settings go in arch/arm/Kconfig, arch/arm/mach-bcmcommon/Kconfig, or some other location?

Regards,
Scott

#4 lore raw

Where do we place common Kconfig options between a "few" machine types?

Quoted 1 line · Scott Branden

Russell (or others),

As a general point, many people use email clients which don't like long lines; please manually wrap at around column 72. Thanks.

Quoted 11 lines

We have a few Kconfig options that are shared between different machines. Where do we place these Kconfig options?

It seems like others have placed these options in the arch/arm/Kconfig and then added depends on for their particular machine architectures. This seems quite messy to me as the Kconfigs only apply to a few machines.

Does something like this make sense: place machine specific Kconfig settings in mach-bcmring, mach-bcm1234, mach-bcm5678 and then place the common settings in another Kconfig file in a "mach-bcmcommon" directory.

Erm, if you're creating one mach- directory per "machine", and the machines are all fairly similar, then you're not doing things quite right. There really isn't a very good name for these directories, so please don't read too much into the prefix.

Most mach-* directories are used to hold all machines for a particular group of SoCs. So, for instance, you'll find all the Atmel SoC support code in mach-at91, all the PXA SoC support in mach-pxa, etc.

Getting that right should help solve your problem.