[PATCH] consolidate lru_add_drain() and lru_drain_cache()

Cc: Christoph Lameter <clameter@engr.sgi.com>
Cc: Rajesh Shah <rajesh.shah@intel.com>
Cc: Li Shaohua <shaohua.li@intel.com>
Cc: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Andrew Morton 2006-01-06 00:11:14 -08:00 коммит произвёл Linus Torvalds
Родитель 210fe53030
Коммит 80bfed904c
1 изменённых файлов: 11 добавлений и 16 удалений

Просмотреть файл

@ -156,16 +156,22 @@ void fastcall lru_cache_add_active(struct page *page)
put_cpu_var(lru_add_active_pvecs); put_cpu_var(lru_add_active_pvecs);
} }
void lru_add_drain(void) static void __lru_add_drain(int cpu)
{ {
struct pagevec *pvec = &get_cpu_var(lru_add_pvecs); struct pagevec *pvec = &per_cpu(lru_add_pvecs, cpu);
/* CPU is dead, so no locking needed. */
if (pagevec_count(pvec)) if (pagevec_count(pvec))
__pagevec_lru_add(pvec); __pagevec_lru_add(pvec);
pvec = &__get_cpu_var(lru_add_active_pvecs); pvec = &per_cpu(lru_add_active_pvecs, cpu);
if (pagevec_count(pvec)) if (pagevec_count(pvec))
__pagevec_lru_add_active(pvec); __pagevec_lru_add_active(pvec);
put_cpu_var(lru_add_pvecs); }
void lru_add_drain(void)
{
__lru_add_drain(get_cpu());
put_cpu();
} }
/* /*
@ -412,17 +418,6 @@ void vm_acct_memory(long pages)
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
static void lru_drain_cache(unsigned int cpu)
{
struct pagevec *pvec = &per_cpu(lru_add_pvecs, cpu);
/* CPU is dead, so no locking needed. */
if (pagevec_count(pvec))
__pagevec_lru_add(pvec);
pvec = &per_cpu(lru_add_active_pvecs, cpu);
if (pagevec_count(pvec))
__pagevec_lru_add_active(pvec);
}
/* Drop the CPU's cached committed space back into the central pool. */ /* Drop the CPU's cached committed space back into the central pool. */
static int cpu_swap_callback(struct notifier_block *nfb, static int cpu_swap_callback(struct notifier_block *nfb,
@ -435,7 +430,7 @@ static int cpu_swap_callback(struct notifier_block *nfb,
if (action == CPU_DEAD) { if (action == CPU_DEAD) {
atomic_add(*committed, &vm_committed_space); atomic_add(*committed, &vm_committed_space);
*committed = 0; *committed = 0;
lru_drain_cache((long)hcpu); __lru_add_drain((long)hcpu);
} }
return NOTIFY_OK; return NOTIFY_OK;
} }