Received: by 10.223.185.116 with SMTP id b49csp670883wrg; Wed, 14 Feb 2018 05:17:21 -0800 (PST) X-Google-Smtp-Source: AH8x227o9d/kZefg7CjaPwb6Uj3pVkI8aRZ/xq4Hpraujy29wMm1oE3IZv/+i8N2vtsL9HZODSz/ X-Received: by 10.98.10.199 with SMTP id 68mr4743553pfk.202.1518614241169; Wed, 14 Feb 2018 05:17:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518614241; cv=none; d=google.com; s=arc-20160816; b=EL2Zv1lTDOUbKcDCxvDjjByeVaX8/Rwh9vSD4u4cti+O7/o9TMCX+QyXWpjZXkj+cd zmqr7TuMiFskMUUONdpafnFM3vQ/SZ4pCr4V3QgNMoMDjfsod4Dviqrvfu0hhgn9JDzi wFwd29Y7rfqKn15B7OCc8SQF/wivJoQ5kOVvG8NLRyiTbvMjTE9UqiquBosuqLF8jw9N 42gHWRtxHeGfNj6W6cBVl+t7Rr5Nl5xct+vqJQKpDM5RJ5ysmJRgQVdPkPrpTjf11HRa O997jFNU+rsoIVI/tdQfIlTWdG4Gv20/dZUqA87XU8zzF4XdrozpyE2mU1+BCkubbaof BV2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=6yWINKOXGgDD07C3KuhJyZHWZo2nMpCbtRYvuUlDFT4=; b=zCmZYL4n5lgB67sz2SdnpaTqJVrMx6QUNWrxkAUKdghssA8FkNuZALCUF/A+EqNvzZ NbNVwRe/gPKZfUH9P9loXZq5zGJXLqpl1+Dk0fmWOAbLsrxo8y94toGfH2i1CM+YEFN+ LK1HB3rk0DxpzaqEoNUommQ620v3pBpuWD8V7YuBsHnSrBUv7BigKoW3lC37jyvy1dcT U7gKuXe4AEnMUukYbGRvVvZEuNqyRc3D/nNl2A++u0mlBdL9jVBuIBgt4SpCXhtVIGS5 KrA6NlckS3ecdLJU5R5Vc0cDmUDMmIAlMmscmqaGRJgYhZim47MdKZa5yesGOY6TUAim cvnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30-v6si1531930pla.812.2018.02.14.05.17.06; Wed, 14 Feb 2018 05:17:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967864AbeBNNQU (ORCPT + 99 others); Wed, 14 Feb 2018 08:16:20 -0500 Received: from terminus.zytor.com ([198.137.202.136]:55415 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967846AbeBNNQR (ORCPT ); Wed, 14 Feb 2018 08:16:17 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1ED4pxf026849; Wed, 14 Feb 2018 05:04:51 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1ED4pXc026845; Wed, 14 Feb 2018 05:04:51 -0800 Date: Wed, 14 Feb 2018 05:04:51 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: "tip-bot for Kirill A. Shutemov" Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, sergey.senozhatsky.work@gmail.com, bp@suse.de, linux-kernel@vger.kernel.org, minchan@kernel.org, mingo@kernel.org, kirill.shutemov@linux.intel.com, torvalds@linux-foundation.org, ngupta@vflare.org, luto@amacapital.net, peterz@infradead.org Reply-To: ngupta@vflare.org, luto@amacapital.net, torvalds@linux-foundation.org, kirill.shutemov@linux.intel.com, mingo@kernel.org, peterz@infradead.org, sergey.senozhatsky.work@gmail.com, tglx@linutronix.de, hpa@zytor.com, minchan@kernel.org, bp@suse.de, linux-kernel@vger.kernel.org In-Reply-To: <20180214111656.88514-3-kirill.shutemov@linux.intel.com> References: <20180214111656.88514-3-kirill.shutemov@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS Git-Commit-ID: 02390b87a9459937cdb299e6b34ff33992512ec7 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 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 02390b87a9459937cdb299e6b34ff33992512ec7 Gitweb: https://git.kernel.org/tip/02390b87a9459937cdb299e6b34ff33992512ec7 Author: Kirill A. Shutemov AuthorDate: Wed, 14 Feb 2018 14:16:49 +0300 Committer: Ingo Molnar CommitDate: Wed, 14 Feb 2018 13:11:13 +0100 mm/zsmalloc: Prepare to variable MAX_PHYSMEM_BITS With boot-time switching between paging mode we will have variable MAX_PHYSMEM_BITS. Let's use the maximum variable possible for CONFIG_X86_5LEVEL=y configuration to define zsmalloc data structures. The patch introduces MAX_POSSIBLE_PHYSMEM_BITS to cover such case. It also suits well to handle PAE special case. Signed-off-by: Kirill A. Shutemov Reviewed-by: Nitin Gupta Acked-by: Minchan Kim Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Sergey Senozhatsky Cc: Thomas Gleixner Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20180214111656.88514-3-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/pgtable-3level_types.h | 1 + arch/x86/include/asm/pgtable_64_types.h | 2 ++ mm/zsmalloc.c | 13 +++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/pgtable-3level_types.h b/arch/x86/include/asm/pgtable-3level_types.h index 876b4c7..6a59a6d 100644 --- a/arch/x86/include/asm/pgtable-3level_types.h +++ b/arch/x86/include/asm/pgtable-3level_types.h @@ -44,5 +44,6 @@ typedef union { */ #define PTRS_PER_PTE 512 +#define MAX_POSSIBLE_PHYSMEM_BITS 36 #endif /* _ASM_X86_PGTABLE_3LEVEL_DEFS_H */ diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 6b8f73d..7168de7 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -40,6 +40,8 @@ typedef struct { pteval_t pte; } pte_t; #define P4D_SIZE (_AC(1, UL) << P4D_SHIFT) #define P4D_MASK (~(P4D_SIZE - 1)) +#define MAX_POSSIBLE_PHYSMEM_BITS 52 + #else /* CONFIG_X86_5LEVEL */ /* diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index c301350..b7f61cd 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -84,18 +84,19 @@ * This is made more complicated by various memory models and PAE. */ -#ifndef MAX_PHYSMEM_BITS -#ifdef CONFIG_HIGHMEM64G -#define MAX_PHYSMEM_BITS 36 -#else /* !CONFIG_HIGHMEM64G */ +#ifndef MAX_POSSIBLE_PHYSMEM_BITS +#ifdef MAX_PHYSMEM_BITS +#define MAX_POSSIBLE_PHYSMEM_BITS MAX_PHYSMEM_BITS +#else /* * If this definition of MAX_PHYSMEM_BITS is used, OBJ_INDEX_BITS will just * be PAGE_SHIFT */ -#define MAX_PHYSMEM_BITS BITS_PER_LONG +#define MAX_POSSIBLE_PHYSMEM_BITS BITS_PER_LONG #endif #endif -#define _PFN_BITS (MAX_PHYSMEM_BITS - PAGE_SHIFT) + +#define _PFN_BITS (MAX_POSSIBLE_PHYSMEM_BITS - PAGE_SHIFT) /* * Memory for allocating for handle keeps object position by