From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752821AbcHKL77 (ORCPT ); Thu, 11 Aug 2016 07:59:59 -0400 Received: from terminus.zytor.com ([198.137.202.10]:53466 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752763AbcHKL7x (ORCPT ); Thu, 11 Aug 2016 07:59:53 -0400 Date: Thu, 11 Aug 2016 04:56:57 -0700 From: tip-bot for Dave Hansen Message-ID: Cc: luto@kernel.org, dave@sr71.net, tglx@linutronix.de, jpoimboe@redhat.com, mcgrof@suse.com, mingo@kernel.org, bp@alien8.de, toshi.kani@hp.com, dvlasenk@redhat.com, peterz@infradead.org, brgerst@gmail.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, hpa@zytor.com, torvalds@linux-foundation.org, dave.hansen@linux.intel.com Reply-To: dvlasenk@redhat.com, peterz@infradead.org, brgerst@gmail.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, luto@kernel.org, dave@sr71.net, tglx@linutronix.de, jpoimboe@redhat.com, mcgrof@suse.com, mingo@kernel.org, toshi.kani@hp.com, bp@alien8.de In-Reply-To: <20160810172325.E56AD7DA@viggo.jf.intel.com> References: <20160810172325.E56AD7DA@viggo.jf.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/mm: Fix swap entry comment and macro Git-Commit-ID: ace7fab7a6cdd363a615ec537f2aa94dbc761ee2 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ace7fab7a6cdd363a615ec537f2aa94dbc761ee2 Gitweb: http://git.kernel.org/tip/ace7fab7a6cdd363a615ec537f2aa94dbc761ee2 Author: Dave Hansen AuthorDate: Wed, 10 Aug 2016 10:23:25 -0700 Committer: Ingo Molnar CommitDate: Thu, 11 Aug 2016 11:04:10 +0200 x86/mm: Fix swap entry comment and macro A recent patch changed the format of a swap PTE. The comment explaining the format of the swap PTE is wrong about the bits used for the swap type field. Amusingly, the ASCII art and the patch description are correct, but the comment itself is wrong. As I was looking at this, I also noticed that the SWP_OFFSET_FIRST_BIT has an off-by-one error. This does not really hurt anything. It just wasted a bit of space in the PTE, giving us 2^59 bytes of addressable space in our swapfiles instead of 2^60. But, it doesn't match with the comments, and it wastes a bit of space, so fix it. Signed-off-by: Dave Hansen Cc: Andrew Morton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Luis R. Rodriguez Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Toshi Kani Fixes: 00839ee3b299 ("x86/mm: Move swap offset/type up in PTE to work around erratum") Link: http://lkml.kernel.org/r/20160810172325.E56AD7DA@viggo.jf.intel.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/pgtable_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 7e8ec7a..1cc82ec 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h @@ -145,7 +145,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; } * * | ... | 11| 10| 9|8|7|6|5| 4| 3|2|1|0| <- bit number * | ... |SW3|SW2|SW1|G|L|D|A|CD|WT|U|W|P| <- bit names - * | OFFSET (14->63) | TYPE (10-13) |0|X|X|X| X| X|X|X|0| <- swp entry + * | OFFSET (14->63) | TYPE (9-13) |0|X|X|X| X| X|X|X|0| <- swp entry * * G (8) is aliased and used as a PROT_NONE indicator for * !present ptes. We need to start storing swap entries above @@ -156,7 +156,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; } #define SWP_TYPE_FIRST_BIT (_PAGE_BIT_PROTNONE + 1) #define SWP_TYPE_BITS 5 /* Place the offset above the type: */ -#define SWP_OFFSET_FIRST_BIT (SWP_TYPE_FIRST_BIT + SWP_TYPE_BITS + 1) +#define SWP_OFFSET_FIRST_BIT (SWP_TYPE_FIRST_BIT + SWP_TYPE_BITS) #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)