From a5ea475753e9d4fd87681577bad169a572dd6c52 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 11 Dec 2005 19:46:02 -0800 Subject: [PATCH] --- yaml --- r: 14974 b: refs/heads/master c: fb155c1619f056ae9765eed272cd6aba6e1a7399 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/acpi/processor_idle.c | 20 +++++--------------- trunk/mm/memory.c | 16 ++++++++++++---- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/[refs] b/[refs] index 86019814be4b..a6dc61f28a3e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 927fe18397b3b1194a5b26b1d388d97e391e5fd2 +refs/heads/master: fb155c1619f056ae9765eed272cd6aba6e1a7399 diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 807b0df308f1..5f51057518b0 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -274,6 +274,8 @@ static void acpi_processor_idle(void) } } + cx->usage++; + #ifdef CONFIG_HOTPLUG_CPU /* * Check for P_LVL2_UP flag before entering C2 and above on @@ -281,12 +283,9 @@ static void acpi_processor_idle(void) * detection phase, to work cleanly with logical CPU hotplug. */ if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && !acpi_fadt.plvl2_up) - cx = &pr->power.states[ACPI_STATE_C1]; + !pr->flags.has_cst && acpi_fadt.plvl2_up) + cx->type = ACPI_STATE_C1; #endif - - cx->usage++; - /* * Sleep: * ------ @@ -387,15 +386,6 @@ static void acpi_processor_idle(void) next_state = pr->power.state; -#ifdef CONFIG_HOTPLUG_CPU - /* Don't do promotion/demotion */ - if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && !acpi_fadt.plvl2_up) { - next_state = cx; - goto end; - } -#endif - /* * Promotion? * ---------- @@ -567,7 +557,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) * Check for P_LVL2_UP flag before entering C2 and above on * an SMP system. */ - if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) + if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up) return_VALUE(-ENODEV); #endif diff --git a/trunk/mm/memory.c b/trunk/mm/memory.c index aa8af0e20269..e65f8fc8ea67 100644 --- a/trunk/mm/memory.c +++ b/trunk/mm/memory.c @@ -377,6 +377,8 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_ unsigned long off = (addr - vma->vm_start) >> PAGE_SHIFT; if (pfn == vma->vm_pgoff + off) return NULL; + if (vma->vm_flags & VM_SHARED) + return NULL; } /* @@ -1343,9 +1345,6 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, struct mm_struct *mm = vma->vm_mm; int err; - if (addr != vma->vm_start || end != vma->vm_end) - return incomplete_pfn_remap(vma, addr, end, pfn, prot); - /* * Physically remapped pages are special. Tell the * rest of the world about it: @@ -1359,9 +1358,18 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, * VM_PFNMAP tells the core MM that the base pages are just * raw PFN mappings, and do not have a "struct page" associated * with them. + * + * There's a horrible special case to handle copy-on-write + * behaviour that some programs depend on. We mark the "original" + * un-COW'ed pages by matching them up with "vma->vm_pgoff". */ + if (!(vma->vm_flags & VM_SHARED)) { + if (addr != vma->vm_start || end != vma->vm_end) + return incomplete_pfn_remap(vma, addr, end, pfn, prot); + vma->vm_pgoff = pfn; + } + vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; - vma->vm_pgoff = pfn; BUG_ON(addr >= end); pfn -= addr >> PAGE_SHIFT;