From patchwork Wed Feb 23 23:53:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 586051 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1NNrh5R002435 for ; Wed, 23 Feb 2011 23:53:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755027Ab1BWXxT (ORCPT ); Wed, 23 Feb 2011 18:53:19 -0500 Received: from hiauly1.hia.nrc.ca ([132.246.10.84]:2726 "EHLO hiauly1.hia.nrc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754481Ab1BWXxR (ORCPT ); Wed, 23 Feb 2011 18:53:17 -0500 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id 213F44E7B; Wed, 23 Feb 2011 18:53:14 -0500 (EST) Date: Wed, 23 Feb 2011 18:53:14 -0500 From: John David Anglin To: Guy Martin Cc: linux-parisc@vger.kernel.org, "Carlos O'Donell" Subject: Re: COW break issue. Where is the patch ? Message-ID: <20110223235313.GA258@hiauly1.hia.nrc.ca> Reply-To: John David Anglin References: <20110222182453.1d9f33da@borg.bxl.tuxicoman.be> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110222182453.1d9f33da@borg.bxl.tuxicoman.be> Organization: nrc.ca User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Feb 2011 23:53:44 +0000 (UTC) diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index 5d7b8ce..4924e23 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -450,20 +450,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, return old_pte; } -static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) -{ -#ifdef CONFIG_SMP - unsigned long new, old; - - do { - old = pte_val(*ptep); - new = pte_val(pte_wrprotect(__pte (old))); - } while (cmpxchg((unsigned long *) ptep, old, new) != old); -#else - pte_t old_pte = *ptep; - set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); -#endif -} +extern void ptep_set_wrprotect(struct mm_struct *, unsigned long, pte_t *); #define pte_same(A,B) (pte_val(A) == pte_val(B)) diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 3f11331..a16430d 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -502,3 +531,22 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long __flush_cache_page(vma, vmaddr, page_to_phys(pfn_to_page(pfn))); } + +void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +{ +#ifdef CONFIG_SMP + unsigned long new, old; + + if (atomic_read(&mm->mm_users) > 1) + flush_dcache_page(pte_page(*ptep)); + do { + old = pte_val(*ptep); + new = pte_val(pte_wrprotect(__pte (old))); + } while (cmpxchg((unsigned long *) ptep, old, new) != old); +#else + pte_t old_pte = *ptep; + if (atomic_read(&mm->mm_users) > 1) + flush_dcache_page(pte_page(old_pte)); + set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); +#endif +}