Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1957312AbdDZIzg (ORCPT ); Wed, 26 Apr 2017 04:55:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58764 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1955963AbdDZIzc (ORCPT ); Wed, 26 Apr 2017 04:55:32 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3FF1181241 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=xpang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3FF1181241 Reply-To: xlpang@redhat.com Subject: Re: [PATCH v2 1/2] x86/mm/ident_map: Add PUD level 1GB page support References: <1493192562-6669-1-git-send-email-xlpang@redhat.com> <20170426080905.gvfjwpoknsgcrsyd@gmail.com> To: Ingo Molnar , Xunlei Pang Cc: Yinghai Lu , x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Ingo Molnar , Borislav Petkov , Eric Biederman , Andy Lutomirski , "H. Peter Anvin" , akpm@linux-foundation.org, Dave Young , Thomas Gleixner From: Xunlei Pang Message-ID: <590060C1.5000904@redhat.com> Date: Wed, 26 Apr 2017 16:56:33 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20170426080905.gvfjwpoknsgcrsyd@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 26 Apr 2017 08:55:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2298 Lines: 50 On 04/26/2017 at 04:09 PM, Ingo Molnar wrote: > * Xunlei Pang wrote: > >> The current kernel_ident_mapping_init() creates the identity >> mapping using 2MB page(PMD level), this patch adds the 1GB >> page(PUD level) support. >> >> This is useful on large machines to save some reserved memory >> (as paging structures) in the kdump case when kexec setups up >> identity mappings before booting into the new kernel. >> >> We will utilize this new support in the following patch. > Well, the primary advantage would be better TLB coverage/performance, because we'd > utilize 1GB TLBs instead of 2MB ones, right? > > Any kexec fallout is secondary. > > And I'd like to hear more about the primary advantage: what are the effects of > this change on a typical test system you have access to: > > - For example what percentage of the identity mapping was 4K mapped (if any) and > 2MB mapped - and how did this change due to the patch - how many 2MB mappings > remained and how many 1GB mappings were added? > > - Is there anything else we could do to improve the in-RAM layout of kernel data > structures. For example IIRC the CPU breaks up all TLBs under 2MB physical into > 4K TLBs. Is this the current limit and could we just reserve all that space and > not use it for anything important? 2MB of RAM wasted is a very small amount of > space, compared to the potential performance advantages. Currently kernel_ident_mapping_init() only setups PMD large pages, seems there are no 4KB mapped or others. Do you mean init_memory_mapping()->kernel_physical_mapping_init()? The new struct x86_mapping_info::direct_gbpages added has the default value false, it has no effect on the existing code, after patch 2, there will be 1GB pages(1GB TLBs) for kexec ident mapping if direct_gbpages is true. > >> void *(*alloc_pgt_page)(void *); /* allocate buf for page table */ >> void *context; /* context for alloc_pgt_page */ >> - unsigned long pmd_flag; /* page flag for PMD entry */ >> + unsigned long page_flag; /* page flag for PMD or PUD entry */ >> unsigned long offset; /* ident mapping offset */ >> + bool direct_gbpages; /* PUD level 1GB page support */ > Doesn't follow the existing alignment. Ah, yes, missed the space. Thanks! Regards, Xunlei