Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965603AbdCXSar (ORCPT ); Fri, 24 Mar 2017 14:30:47 -0400 Received: from mail-dm3nam03on0127.outbound.protection.outlook.com ([104.47.41.127]:34112 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754597AbdCXSah (ORCPT ); Fri, 24 Mar 2017 14:30:37 -0400 Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=cs.rutgers.edu; Message-ID: <58D565C5.2080001@cs.rutgers.edu> Date: Fri, 24 Mar 2017 13:30:29 -0500 From: Zi Yan User-Agent: Postbox 5.0.11 (Windows/20170302) MIME-Version: 1.0 To: Tim Chen CC: Zi Yan , , , , , , , , , , , Subject: Re: [PATCH v4 01/11] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1 References: <20170313154507.3647-1-zi.yan@sent.com> <20170313154507.3647-2-zi.yan@sent.com> <1490379805.2733.133.camel@linux.intel.com> In-Reply-To: <1490379805.2733.133.camel@linux.intel.com> X-Enigmail-Version: 1.2.3 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig7AEDB524ED0655C9B8BC2D8F" X-Originating-IP: [12.1.252.66] X-ClientProxiedBy: SN1PR19CA0034.namprd19.prod.outlook.com (10.163.220.44) To BN6PR14MB1651.namprd14.prod.outlook.com (10.171.176.17) X-MS-Office365-Filtering-Correlation-Id: 6222373b-fcbc-4980-86b8-08d472e3dc85 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR14MB1651; X-Microsoft-Exchange-Diagnostics: 1;BN6PR14MB1651;3:KURc13h9dsMKoMPyD/v82BWE5VGhOqkoXPxGjFq3ygpNldaX8PU5yuySbEtbNnVTU/FAIPzj6zIn7fPHgrSRXRiT2YiXD2rcWvAEuW4oOuum0cAHRbiAwTtD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ihYYhZVwzx2PCzqakSvJrNC0Z18Y36WhmjHKq48v469a++OzQ0W0rm7ywjcAm7JO8mYTj4fqc7cLR68s2d7oVLuz6xxHJxOjsrqkn0gijoADhqKB4XyWYtNtl19LQRLnsl+YexjVn6J1IR51IGZorlRhe2f0ISvdMQblCB/hVDUYQA7peqH2arVQlJFjpKecCLPwgvhFR3yHZZpkXAf6UX0HJV87HCv9sYSVqfdOyTVHD88VWWTkwMt9iDjDL3zF+9wAX1/2Az8JbxTxk03X9eiz05mAWvcgc4IvbWV7BczjYictxVS0DtGisIyukRRsQ6pRd2dN4v3EhcQ1CmS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558025)(6072148);SRVR:BN6PR14MB1651;BCL:0;PCL:0;RULEID:;SRVR:BN6PR14MB1651; X-Microsoft-Exchange-Diagnostics: 1;BN6PR14MB1651;4:Z8DLVjuHX+cTSLPrrC5xi2Ge1CV4sphs9oGFwXhO04MXkEwxDdwLpKVNxourBulURJySI+ZrZnKPWkxF9QReJqQSPaGnLrBsf4JjZABi6FblcXF+x/wYKeHKjaMVroVxLG/kBaPJs1lCZPXJnKwnU9mrEpMyGx1u4LpL23ZMYd8aDqh5wCPI3+VTcS8/K+RRFnUY18ThZH4d7QorCSUsQTDuHXn7CgQCCUF+GFM8SXogXKG3chBsN7o8dtE70gWC59tRfGf3fFrRbCIz2M+dVroNmKRNJUYeRBN4fFlKVxFMuiMG8TvIPgIECeJ3fv/mgJ6f+S+ZM7ar/zqs5nZXq0bRNi+0UbvSubiRcEsOWap/iNtmL0LSNdckosfYFctULpZdx3VO1WybtSDmd03K0/4gKyfeNlkuFje8lKJJ0ALXjEKB1CvvTZ8BqTS/SlZewLWL5LxQPuB5JB4y8dgkalKFasdLB+HA/MacFnbZzGhHFWvTn8xDnrrGjpwZlOq0G5hOsK7h2uFRHb75WnlBDD5JK+a94qu4ovrCoH0wBTTHlpxs5NihFH1TpySPuVTxkmv4sHXuc4eburETIOfYpKab2Rh4+9Sfe+8+FonOnH4= X-Forefront-PRVS: 0256C18696 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(39450400003)(39830400002)(39410400002)(377424004)(24454002)(8656002)(2906002)(81166006)(76176999)(42186005)(189998001)(83506001)(21480400002)(65816999)(568964002)(88552002)(305945005)(6486002)(5890100001)(25786009)(86362001)(8676002)(59896002)(66066001)(7736002)(3846002)(110136004)(75432002)(4326008)(84326002)(229853002)(53936002)(38730400002)(54356999)(5660300001)(7416002)(4001350100001)(6666003)(80316001)(6246003)(6916009)(512874002)(54906002)(2950100002)(42882006)(6116002)(77096006)(50986999)(33656002)(90366009);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR14MB1651;H:[10.20.179.71];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR14MB1651;23:nnjbulA+LOc66rH+Y5YNk2Lmda43HhNiFA/vFoH4T?= =?us-ascii?Q?N6chfwKqhUgwi7sKSq+ck9JQNRpfo1pnZEejx3+N1iKA+aWurUvOZKJ0V8qs?= =?us-ascii?Q?9bfzwvU5P/6cvww/V7x45wGqS2AHY/OipcJ3pK5SGkOTclW9hNsXVX7jkse9?= =?us-ascii?Q?4fnBYKqgmQ5+kSipfdNGo+JEYNl7ZgydzQpl3OdYEWykXlnxc1Lz2A2ePPWX?= =?us-ascii?Q?FEB7DwUjdKRR5xFqeymgBs+NNjFd8aLdpy5MTo5bEdEXeDE/kCVgE7jpQGPE?= =?us-ascii?Q?vIQYmykJ7/tIhLky7OzK1fjRTapURFtHn3G3gcUnmiTWuQzQyL8s4EA5e0Px?= =?us-ascii?Q?UrY5GGi5fChyXgmL1j/on3/eq3kd2jrYWMsuSBa0bVN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KwmOfkUpPVDvL7TXb0ov3mH0i7zhsyBP13p0E5QVR4GZWChMtMNIR?= =?us-ascii?Q?m+i+wDyIqdFKeKhQHWu6H4=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN6PR14MB1651;6:UTPuJoduXijPTbxjhJynBFTCu6g3+U0KlQZh+ZaHyqA28OW40GBds8qYnP+YcLVSKvkI8hVEhaQIDIpNTucE00l39827dW2MgC+fT8sVxtWGYO/mgTUKfQpRg8sl+G1bfzuazY0d4wqZk2/1dnTR85XpSELfz8S7TSK7DQzqSSYKKfcOfB2Xj+K6ee5KtHlBNFGwrIP/N/An/sgm4kiUYuMo3ao68Zn9663LW+N1Ta8YskknCBEGwK++1FiY7mNCLCsz7u9YVYhrYplyMLhw/hsPVsgvxGQzHcTNyXpKDh2tDgpvywVVLdWO+S47zgG6AAnmBL9r2mtpO+kN5m6tuDYXGAUQVsbihcCRRRUqMXtdQEIdXpx5icZ3TUoxFLDRvr3WXVBTnr4RjSGH/Ab20A==;5:A76Wm5JB5mAxTJFtYXbgru7JZNlpoquvO/Bjar60ef2Jdt3oHnsSPdsDcTNz9YT4hZlvf10tJ252y0cHaYuN2UOhl1a26WGxzGjQI2LsM223k5//2uRWjvYYwUdd5ETsh87nxmZTaox9RmwYWn5duw==;24:ftziWWtJQ26j8Ofg17futq5hDHBMV+nGmBJ7OJe0b3mXDiL6XZMcQpYwrTe3q5ZvjW4fc6i92w5UaDub0c81EVJ/XG4QMUorNJAr+dLFHdo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR14MB1651;7:Z9jqbbOhxAscFz/eNj+M40bUB3Ky3Q+H0mLsUHUImfjqBzQ5k21lZUCPjfnK0P/x9A+xVYvfSFcJmonY8y90H0X6N/30mH6CkNOhJ/facFTvx5QMeEsm1V/IHVqyoEWCHb0GIwCPaKMv/apjb3U3rxwxcikrx2+OYNXh8nT+F8ebENsIZea3mgCRFHL7s7pxRJBYCf4p1Cx/bLDTpcLSFWrq730jqdBx1/xJj9dkorhvHnhO1/B8RPoJezst9cEOoBMlOAnVMS96cutbuw8IOGSxYXczEbeO+6/TLUPjfvZNwLuy0Em5oOfBZBKqvYc1EJQy9nHKyaQz/O8iZ78Dyw== X-OriginatorOrg: cs.rutgers.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 18:30:33.6072 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR14MB1651 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3380 Lines: 94 --------------enig7AEDB524ED0655C9B8BC2D8F Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Tim Chen wrote: > On Mon, 2017-03-13 at 11:44 -0400, Zi Yan wrote: >> From: Naoya Horiguchi >> >> pmd_present() checks _PAGE_PSE along with _PAGE_PRESENT to avoid >> false negative return when it races with thp spilt >> (during which _PAGE_PRESENT is temporary cleared.) I don't think that >> dropping _PAGE_PSE check in pmd_present() works well because it can >> hurt optimization of tlb handling in thp split. >> In the current kernel, bits 1-4 are not used in non-present format >> since commit 00839ee3b299 ("x86/mm: Move swap offset/type up in PTE to= >> work around erratum"). So let's move _PAGE_SWP_SOFT_DIRTY to bit 1. >> Bit 7 is used as reserved (always clear), so please don't use it for >> other purpose. >> >> Signed-off-by: Naoya Horiguchi >> Signed-off-by: Zi Yan >> --- >> arch/x86/include/asm/pgtable_64.h | 12 +++++++++--- >> arch/x86/include/asm/pgtable_types.h | 10 +++++----- >> 2 files changed, 14 insertions(+), 8 deletions(-) >> >> diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/= pgtable_64.h >> index 73c7ccc38912..a5c4fc62e078 100644 >> --- a/arch/x86/include/asm/pgtable_64.h >> +++ b/arch/x86/include/asm/pgtable_64.h >> @@ -157,15 +157,21 @@ static inline int pgd_large(pgd_t pgd) { return = 0; } >> /* >> * Encode and de-code a swap entry >> * >> - * | ... | 11| 10| 9|8|7|6|5| 4| 3|2|1|0| <- bit numb= er >> - * | ... |SW3|SW2|SW1|G|L|D|A|CD|WT|U|W|P| <- bit name= s >> - * | OFFSET (14->63) | TYPE (9-13) |0|X|X|X| X| X|X|X|0| <- swp entr= y >> + * | ... | 11| 10| 9|8|7|6|5| 4| 3|2| 1|0| <- bit num= ber >> + * | ... |SW3|SW2|SW1|G|L|D|A|CD|WT|U| W|P| <- bit nam= es >> + * | OFFSET (14->63) | TYPE (9-13) |0|0|X|X| X| X|X|SD|0| <- swp ent= ry >> * >> * G (8) is aliased and used as a PROT_NONE indicator for >> * !present ptes. We need to start storing swap entries above >> * there. We also need to avoid using A and D because of an >> * erratum where they can be incorrectly set by hardware on >> * non-present PTEs. >> + * >> + * SD (1) in swp entry is used to store soft dirty bit, which helps u= s >> + * remember soft dirty over page migration >> + * >> + * Bit 7 in swp entry should be 0 because pmd_present checks not only= P, >> + * but also G. >=20 > but also L and G. Got it. Thanks. --=20 Best Regards, Yan Zi --------------enig7AEDB524ED0655C9B8BC2D8F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJY1WXFAAoJEEGLLxGcTqbMtvEH/jDZx2rPiOFQMaBtzYW9Sfgx hNidwOsXgXoNpBMul74m4LYBqcMSvTNr/+c1NKmM+Ge5RfACzW4aQF4JSXOsxzoL zgqkRRisuy5FuPDklpUJ77MBfuQZ5k2PswsrnxC/VGPJ3jNo4JxnhTKwB4M7Uull G1OsqdOIY4ITpv3FXiPE2mjAYQ2e7sHf1JjosDEy2jrq4j/DtUjJ8oD8psAinQ8C t1vezK/nKjGjx3dW/EP728v//g6bphS91x8xyZhGlxaQrz9vC1hPPsmLSlSyOx2x SawnLATtBrjj3YMRFosk7/jP0jTnJzmtYpR8/jzrCqOZs02m2gqmdWEDweIG0/g= =7Ew2 -----END PGP SIGNATURE----- --------------enig7AEDB524ED0655C9B8BC2D8F--