[PATCH 4 of 6] hotplug-memory: use common online_page - Kernel

This is a discussion on [PATCH 4 of 6] hotplug-memory: use common online_page - Kernel ; Apart from x86-32, all architectures use an identical online_page. Define it weakly in mm/memory_hotplug.c so that architectures can override it if necessary. Signed-off-by: Jeremy Fitzhardinge --- arch/ia64/mm/init.c | 9 --------- arch/powerpc/mm/mem.c | 9 --------- arch/sh/mm/init.c | 9 --------- arch/x86/mm/init_64.c | ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: [PATCH 4 of 6] hotplug-memory: use common online_page

  1. [PATCH 4 of 6] hotplug-memory: use common online_page

    Apart from x86-32, all architectures use an identical online_page.
    Define it weakly in mm/memory_hotplug.c so that architectures can
    override it if necessary.

    Signed-off-by: Jeremy Fitzhardinge
    ---
    arch/ia64/mm/init.c | 9 ---------
    arch/powerpc/mm/mem.c | 9 ---------
    arch/sh/mm/init.c | 9 ---------
    arch/x86/mm/init_64.c | 9 ---------
    mm/memory_hotplug.c | 9 +++++++++
    5 files changed, 9 insertions(+), 36 deletions(-)

    diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
    --- a/arch/ia64/mm/init.c
    +++ b/arch/ia64/mm/init.c
    @@ -690,15 +690,6 @@
    }

    #ifdef CONFIG_MEMORY_HOTPLUG
    -void online_page(struct page *page)
    -{
    - ClearPageReserved(page);
    - init_page_count(page);
    - __free_page(page);
    - totalram_pages++;
    - num_physpages++;
    -}
    -
    int arch_add_memory(int nid, u64 start, u64 size)
    {
    pg_data_t *pgdat;
    diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
    --- a/arch/powerpc/mm/mem.c
    +++ b/arch/powerpc/mm/mem.c
    @@ -94,15 +94,6 @@
    EXPORT_SYMBOL(phys_mem_access_prot);

    #ifdef CONFIG_MEMORY_HOTPLUG
    -
    -void online_page(struct page *page)
    -{
    - ClearPageReserved(page);
    - init_page_count(page);
    - __free_page(page);
    - totalram_pages++;
    - num_physpages++;
    -}

    #ifdef CONFIG_NUMA
    int memory_add_physaddr_to_nid(u64 start)
    diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
    --- a/arch/sh/mm/init.c
    +++ b/arch/sh/mm/init.c
    @@ -307,15 +307,6 @@
    #endif

    #ifdef CONFIG_MEMORY_HOTPLUG
    -void online_page(struct page *page)
    -{
    - ClearPageReserved(page);
    - init_page_count(page);
    - __free_page(page);
    - totalram_pages++;
    - num_physpages++;
    -}
    -
    int arch_add_memory(int nid, u64 start, u64 size)
    {
    pg_data_t *pgdat;
    diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
    --- a/arch/x86/mm/init_64.c
    +++ b/arch/x86/mm/init_64.c
    @@ -624,15 +624,6 @@
    /*
    * Memory hotplug specific functions
    */
    -void online_page(struct page *page)
    -{
    - ClearPageReserved(page);
    - init_page_count(page);
    - __free_page(page);
    - totalram_pages++;
    - num_physpages++;
    -}
    -
    #ifdef CONFIG_MEMORY_HOTPLUG
    /*
    * Memory is added always to NORMAL zone. This means you will never get
    diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
    --- a/mm/memory_hotplug.c
    +++ b/mm/memory_hotplug.c
    @@ -145,6 +145,15 @@

    pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
    pgdat->node_start_pfn;
    +}
    +
    +__weak void online_page(struct page *page)
    +{
    + ClearPageReserved(page);
    + init_page_count(page);
    + __free_page(page);
    + totalram_pages++;
    + num_physpages++;
    }

    static void grow_zone_span(unsigned long start_pfn, unsigned long end_pfn)


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

  2. Re: [PATCH 4 of 6] hotplug-memory: use common online_page


    On Thu, 2008-04-03 at 17:05 -0700, Jeremy Fitzhardinge wrote:
    > Apart from x86-32, all architectures use an identical online_page.
    > Define it weakly in mm/memory_hotplug.c so that architectures can
    > override it if necessary.


    This is OK, but I do think the __weak stuff can make it a bit
    counter-intuitive to track down which version is actually getting used.
    Are there any people the currently override that __weak?

    If not, we should probably just kill it.

    -- Dave

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

  3. Re: [PATCH 4 of 6] hotplug-memory: use common online_page

    Dave Hansen wrote:
    > This is OK, but I do think the __weak stuff can make it a bit
    > counter-intuitive to track down which version is actually getting used.
    > Are there any people the currently override that __weak?
    >
    > If not, we should probably just kill it.
    >


    Yes, x86-32 has a different implementation.

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

  4. Re: [PATCH 4 of 6] hotplug-memory: use common online_page

    On Thu, 2008-04-03 at 17:56 -0700, Jeremy Fitzhardinge wrote:
    > Dave Hansen wrote:
    > > This is OK, but I do think the __weak stuff can make it a bit
    > > counter-intuitive to track down which version is actually getting used.
    > > Are there any people the currently override that __weak?
    > >
    > > If not, we should probably just kill it.

    >
    > Yes, x86-32 has a different implementation.


    I guess we could just make the copies conditional on CONFIG_HIGHMEM and
    define them both next to each other. It's really a highmem thing more
    than a per-arch thing.

    -- Dave

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

  5. Re: [PATCH 4 of 6] hotplug-memory: use common online_page

    Dave Hansen wrote:
    > I guess we could just make the copies conditional on CONFIG_HIGHMEM and
    > define them both next to each other. It's really a highmem thing more
    > than a per-arch thing.


    Sounds good to me. On that subject, how different are the various
    arch_add_memory() functions really? There seems to be a lot of common
    stuff in there.

    J

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

  6. Re: [PATCH 4 of 6] hotplug-memory: use common online_page


    On Thu, 2008-04-03 at 18:11 -0700, Jeremy Fitzhardinge wrote:
    > Dave Hansen wrote:
    > > I guess we could just make the copies conditional on CONFIG_HIGHMEM and
    > > define them both next to each other. It's really a highmem thing more
    > > than a per-arch thing.

    >
    > Sounds good to me. On that subject, how different are the various
    > arch_add_memory() functions really? There seems to be a lot of common
    > stuff in there.


    Not to different last I looked. But, they're small enough (like
    online_page()) that we didn't really care. We waited for someone like
    you to come along and care enough to fix it up.

    -- Dave

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

+ Reply to Thread