All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Allison Randal <allison@lohutok.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm/mm: Drop [PTE|PMD]_TYPE_FAULT
Date: Thu, 13 May 2021 11:52:34 +0100	[thread overview]
Message-ID: <20210513105234.GW1336@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210513080353.GR1336@shell.armlinux.org.uk>

On Thu, May 13, 2021 at 09:03:53AM +0100, Russell King - ARM Linux admin wrote:
> On Thu, May 13, 2021 at 11:21:53AM +0530, Anshuman Khandual wrote:
> > Drop these unused symbols i.e PTE_TYPE_FAULT and PMD_TYPE_FAULT.
> 
> They're documentation, although PTE_TYPE_FAULT ought to be used by
> __swp_entry() to show that better.

So really, we should be doing something like this:

diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index c02f24400369..c43e07d6046d 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -303,7 +303,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) })
 
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
-#define __swp_entry_to_pte(swp)	((pte_t) { (swp).val })
+#define __swp_entry_to_pte(swp)	__pte((swp).val | PTE_TYPE_FAULT)
 
 /*
  * It is an error for the kernel to have more swap files than we can

Since that is really what is going on here. It is by design that the
swp_entry_t is layed out to be correct, and of course because
PTE_TYPE_FAULT has the value of zero, the above merely adds to the
"documentation" rather than having any functional effect.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Allison Randal <allison@lohutok.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm/mm: Drop [PTE|PMD]_TYPE_FAULT
Date: Thu, 13 May 2021 11:52:34 +0100	[thread overview]
Message-ID: <20210513105234.GW1336@shell.armlinux.org.uk> (raw)
In-Reply-To: <20210513080353.GR1336@shell.armlinux.org.uk>

On Thu, May 13, 2021 at 09:03:53AM +0100, Russell King - ARM Linux admin wrote:
> On Thu, May 13, 2021 at 11:21:53AM +0530, Anshuman Khandual wrote:
> > Drop these unused symbols i.e PTE_TYPE_FAULT and PMD_TYPE_FAULT.
> 
> They're documentation, although PTE_TYPE_FAULT ought to be used by
> __swp_entry() to show that better.

So really, we should be doing something like this:

diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index c02f24400369..c43e07d6046d 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -303,7 +303,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) })
 
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
-#define __swp_entry_to_pte(swp)	((pte_t) { (swp).val })
+#define __swp_entry_to_pte(swp)	__pte((swp).val | PTE_TYPE_FAULT)
 
 /*
  * It is an error for the kernel to have more swap files than we can

Since that is really what is going on here. It is by design that the
swp_entry_t is layed out to be correct, and of course because
PTE_TYPE_FAULT has the value of zero, the above merely adds to the
"documentation" rather than having any functional effect.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2021-05-13 10:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  5:51 [PATCH] arm/mm: Drop [PTE|PMD]_TYPE_FAULT Anshuman Khandual
2021-05-13  5:51 ` Anshuman Khandual
2021-05-13  8:03 ` Russell King - ARM Linux admin
2021-05-13  8:03   ` Russell King - ARM Linux admin
2021-05-13 10:52   ` Russell King - ARM Linux admin [this message]
2021-05-13 10:52     ` Russell King - ARM Linux admin
  -- strict thread matches above, loose matches on Subject: below --
2020-06-16  3:22 Anshuman Khandual
2020-06-16  3:22 ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210513105234.GW1336@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=allison@lohutok.net \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.