lkml.org 
[lkml]   [2004]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    SubjectRe: [PATCH][2.6-mm] split drain_local_pages
    Date
    In message <Pine.LNX.4.58.0402161720390.11793@montezuma.fsmlabs.com> you write:
    > CPU hotplug core needs to pass a cpu parameter to drain_local_pages, it's
    > safe to call __drain_local_pages if the cpu being drained is offline. The
    > semantics for drain_local_pages do not change.

    I prefer this version: it gets the #ifdef correct too.

    Name: Introduce __drain_pages() To Take a CPU Number
    Author: Rusty Russell
    Status: Booted on 2.6.2-rc2-bk2

    Hotplug CPU needs to drain pages on a downed CPU (usually it's the
    current cpu). Introduce "__drain_pages", make the CPU an argument,
    and expose it if CONFIG_HOTPLUG_CPU as well as CONFIG_PM.

    diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26287-linux-2.6.3-rc3-bk1/mm/page_alloc.c .26287-linux-2.6.3-rc3-bk1.updated/mm/page_alloc.c
    --- .26287-linux-2.6.3-rc3-bk1/mm/page_alloc.c 2004-02-15 18:17:22.000000000 +1100
    +++ .26287-linux-2.6.3-rc3-bk1.updated/mm/page_alloc.c 2004-02-17 17:22:10.000000000 +1100
    @@ -390,6 +390,27 @@ static int rmqueue_bulk(struct zone *zon
    return allocated;
    }

    +#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU)
    +static void __drain_pages(unsigned int cpu)
    +{
    + struct zone *zone;
    + int i;
    +
    + for_each_zone(zone) {
    + struct per_cpu_pageset *pset;
    +
    + pset = &zone->pageset[cpu];
    + for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
    + struct per_cpu_pages *pcp;
    +
    + pcp = &pset->pcp[i];
    + pcp->count -= free_pages_bulk(zone, pcp->count,
    + &pcp->list, 0);
    + }
    + }
    +}
    +#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU */
    +
    #ifdef CONFIG_PM
    int is_head_of_free_region(struct page *page)
    {
    @@ -419,22 +440,9 @@ int is_head_of_free_region(struct page *
    void drain_local_pages(void)
    {
    unsigned long flags;
    - struct zone *zone;
    - int i;

    local_irq_save(flags);
    - for_each_zone(zone) {
    - struct per_cpu_pageset *pset;
    -
    - pset = &zone->pageset[smp_processor_id()];
    - for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
    - struct per_cpu_pages *pcp;
    -
    - pcp = &pset->pcp[i];
    - pcp->count -= free_pages_bulk(zone, pcp->count,
    - &pcp->list, 0);
    - }
    - }
    + __drain_pages(smp_processor_id());
    local_irq_restore(flags);
    }
    #endif /* CONFIG_PM */
    @@ -1574,7 +1586,7 @@ static int page_alloc_cpu_notify(struct
    count = &per_cpu(nr_pagecache_local, cpu);
    atomic_add(*count, &nr_pagecache);
    *count = 0;
    - drain_local_pages(cpu);
    + __drain_pages(cpu);
    }
    return NOTIFY_OK;
    }
    --
    Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 14:01    [W:0.022 / U:153.644 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site