Re: [PATCH] s390: Add pmd_mknotpresent()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 29 Oct 2012 12:05:19 +0100
Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> 
> * Martin Schwidefsky <schwidefsky@xxxxxxxxxx> wrote:
> 
> > On Sun, 28 Oct 2012 14:10:14 +0100
> > Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> > 
> > > 
> > > There's a related problem on s390: other THP implementations 
> > > have pmd_mknotpresent() while s390 not, resulting in:
> > > 
> > >   mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'
> > > 
> > > The (untested!) patch below adds the s390 version of this 
> > > method.
> > > 
> > > Gerald, Martin, did I get the S390 details right?
> > 
> > This won't work I'm afraid. S390 uses invalid bits which need 
> > to be set to make an entry not present. Just setting the 
> > _SEGMENT_ENTRY_INV bit is not good enough either, there is 
> > _HPAGE_TYPE_NONE to consider. The patch to fix this for 
> > pmd_none & pmd_present just got added to the s390 tree on 
> > kernel.org:
> >
> > https://git.kernel.org/?p=linux/kernel/git/s390/linux.git;a=shortlog;h=refs/heads/fixes
> > 
> > Now, if pmd_mknotpresent is supposed to make the entry invalid 
> > so that pmd_present will return false the function needs to do 
> > two things, 1) set the _SEGMENT_ENTRY_INV bit, and 2) clear 
> > the _SEGMENT_ENTRY_RO bit.
> 
> Would be nice if you could send me your suggested 
> pmd_mknotpresent().
> 
> (Writing it into the email would be enough, I can turn it into a 
> patch - but a patch would be welcome as well.)

This would look like the following, the patch should apply to all recent
kernel version.
--
Subject: [PATCH] s390,mm: add pmd_mknotpresent

Fix the following build problem in huge_memory:

mm/huge_memory.c:1543:2: error: implicit declaration of function 'pmd_mknotpresent'

Signed-off-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
---
 arch/s390/include/asm/pgtable.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 335b601..4a84431 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1326,6 +1326,13 @@ static inline pmd_t pmd_mkyoung(pmd_t pmd)
 	return pmd;
 }
 
+static inline pmd_t pmd_mknotpresent(pmd_t pmd)
+{
+	pmd_val(pmd) |= _SEGMENT_ENTRY_INV;
+	pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
+	return pmd;
+}
+
 #define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
 static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
 					    unsigned long address, pmd_t *pmdp)
-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux