Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756215AbcKJX3z (ORCPT ); Thu, 10 Nov 2016 18:29:55 -0500 Received: from mga07.intel.com ([134.134.136.100]:25702 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755861AbcKJX3w (ORCPT ); Thu, 10 Nov 2016 18:29:52 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,620,1473145200"; d="scan'208";a="900167717" Subject: Re: [PATCH v2 01/12] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 6 To: Naoya Horiguchi , linux-mm@kvack.org References: <1478561517-4317-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1478561517-4317-2-git-send-email-n-horiguchi@ah.jp.nec.com> Cc: "Kirill A. Shutemov" , Hugh Dickins , Andrew Morton , Andrea Arcangeli , Mel Gorman , Michal Hocko , Vlastimil Babka , Pavel Emelyanov , Zi Yan , Balbir Singh , linux-kernel@vger.kernel.org, Naoya Horiguchi From: Dave Hansen Message-ID: <534caa72-c109-9716-15d2-5e80f4038f8d@intel.com> Date: Thu, 10 Nov 2016 15:29:51 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1478561517-4317-2-git-send-email-n-horiguchi@ah.jp.nec.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1180 Lines: 25 On 11/07/2016 03:31 PM, Naoya Horiguchi wrote: > 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, bit 6 is not used in non-present format because nonlinear > file mapping is obsolete, so let's move _PAGE_SWP_SOFT_DIRTY to that bit. > Bit 7 is used as reserved (always clear), so please don't use it for other > purpose. ... > #ifdef CONFIG_MEM_SOFT_DIRTY > -#define _PAGE_SWP_SOFT_DIRTY _PAGE_PSE > +#define _PAGE_SWP_SOFT_DIRTY _PAGE_DIRTY > #else > #define _PAGE_SWP_SOFT_DIRTY (_AT(pteval_t, 0)) > #endif I'm not sure this works. Take a look at commit 00839ee3b29 and the erratum it works around. I _think_ this means that a system affected by the erratum might see an erroneous _PAGE_SWP_SOFT_DIRTY/_PAGE_DIRTY get set in swap ptes. There are much worse things that can happen, but I don't think bits 5 (Accessed) and 6 (Dirty) are good choices since they're affected by the erratum.