Received: by 10.192.165.148 with SMTP id m20csp2211732imm; Thu, 26 Apr 2018 07:33:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx498fFnbG/1B2hKReQ2d+cAZkKE6RHNPba1ATlBVSc+qG1t7HBjP4F6JMVyfEhxp6Ki9BZhr X-Received: by 2002:a17:902:7d92:: with SMTP id a18-v6mr34650169plm.331.1524753196578; Thu, 26 Apr 2018 07:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524753196; cv=none; d=google.com; s=arc-20160816; b=pFqMlfdGpDj6k0gVjAFDgC73g0hhXk+iUzjFJcDO/Aw/q1aQkLSRV4eJHtQ6FKfaD6 /kYxbzHkyCakLLUMoLn1sZ9tXYlxEPWCXWaRqzJK+NgtdJc46ViPyrKWEtPSpe80oV56 XzhVWYO8K9RnoGrV4H9P1WzLw+dGzZz5QofSA7Nqo+sxsdZWojF54rpu3jG4FAoTozRt DWwZwIx8o7slMMO9xIzf/djEc4c0LVT1XpzU7suhdxtvz36RKURBPyLyfM9pUpCtBEwZ XCcQ+UJSUh80AstybapIM94Qz/Gp2ugKUqoLta1ZW4nrzsQcIEzeqoXVIdwG8mbGgJel sslQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature :arc-authentication-results; bh=+PW5qZGke3xNRAh3ZS9d9w9H0AfOzcuG/LtxeR74fs4=; b=cTlIdEbJLulrBNXxU4tvmDPgDMrdfihfcUVgEStZiSWlBdzLnV0arLgTZDXamMdKtz gUvW57ruKP/iL+anmiMoTxG27Co2DgoktBhjS8roDurM1Gc8qEY2hnGdw0JinRJDD5Me FidCpsQ68RQtWYBjUPbMF9qQpkUM8krNi8n/R/mHaLUqvrmcBvb9Gy97eut/lur0MXSq Dxe0vW+fJL7aAW50JAqQtOkVfLMfKl8wePJO+W329B1k8dFMcSA2QdiyDgOQMysqOLqJ 5gp4m6LbeumQmQMKWfczJTMH/s73Y1sbW4XhdfkV002Ifw3ej2qP2uU0YdRnnOPelWUT DlKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm3 header.b=mrfeWWew; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=JlEETToU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m198si15388091pga.107.2018.04.26.07.33.02; Thu, 26 Apr 2018 07:33:16 -0700 (PDT) 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; dkim=pass header.i=@sent.com header.s=fm3 header.b=mrfeWWew; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=JlEETToU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932219AbeDZOaL (ORCPT + 99 others); Thu, 26 Apr 2018 10:30:11 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:55043 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756551AbeDZO2w (ORCPT ); Thu, 26 Apr 2018 10:28:52 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 989CC218D8; Thu, 26 Apr 2018 10:28:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 26 Apr 2018 10:28:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=+PW5qZGke3xNRAh3Z S9d9w9H0AfOzcuG/LtxeR74fs4=; b=mrfeWWewjJaNi6r70kq1XbP+FMIwMJtPq lnHw8yCrgGfm03DY3O9rID/QbHhogIaUpBFZ3lBiyoIaX4i10qo8AfOwK75ZkW/L oOWkA3Z4opRoydgPeh8BIv9NOaa1M8WmuEYxBzvZ5wRrsbZIc3QRBA/HJJNc/W3E K6/4kspxro38tVyowCrWmGgdJrxYAKOLj6nvXdBeJZXOdMzLHRMSX+PAFw4YBiJ5 qDlDPMfmEHvFnn/KioTzMvrSNZAl2TboZ69E8tHzNhsSkGDAv+g83/qRwHLb91uX NM3bln8HyNOajEPqYsz5eAdXe2rofYUfamd/f1XLIOKlNjPzZjnUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=+PW5qZGke3xNRAh3ZS9d9w9H0AfOzcuG/LtxeR74fs4=; b=JlEETToU Apqi3ZjjaC5AG2lVqR8kL8Gi6nxUljebsX748X63auhrpLv1pzHnN+BOhdSReoxd ONOcdRfzgQkBWpGUS50kNc184pczUVPF3HvpzyFxApyFRzIbQSGjMgw5NgvqTLc1 J+6SB6cVD5my3YadOyWSPUN4puD7vtAWT4RDQwWXxc43WyKFzK7y2UZ7062bHCW9 t6ZKvbM05O/KDjiUHeqA9Cupgd/N4pSeRilNsJipJB0KM/mOTfAH97ADgTNczKTa RzePxwIYeYrR2Yi2eapBs1HLDfjU6NxnnDIh3E5Osz3JpGU502HNKNDhSZ87kbjh Pu9fYF6cBJNDGQ== X-ME-Sender: Received: from tenansix.rutgers.edu (pool-165-230-225-59.nat.rutgers.edu [165.230.225.59]) by mail.messagingengine.com (Postfix) with ESMTPA id 2FF1CE4120; Thu, 26 Apr 2018 10:28:51 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Zi Yan , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "Aneesh Kumar K.V" , Ram Pai , Balbir Singh , Naoya Horiguchi , linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH 6/9] powerpc: mm: migrate: add pmd swap entry to support thp migration. Date: Thu, 26 Apr 2018 10:28:01 -0400 Message-Id: <20180426142804.180152-7-zi.yan@sent.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180426142804.180152-1-zi.yan@sent.com> References: <20180426142804.180152-1-zi.yan@sent.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zi Yan pmd swap soft dirty support is added, too. Signed-off-by: Zi Yan Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: "Aneesh Kumar K.V" Cc: Ram Pai Cc: Balbir Singh Cc: Naoya Horiguchi Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-mm@kvack.org --- arch/powerpc/include/asm/book3s/32/pgtable.h | 2 ++ arch/powerpc/include/asm/book3s/64/pgtable.h | 17 +++++++++++++++++ arch/powerpc/include/asm/nohash/32/pgtable.h | 2 ++ arch/powerpc/include/asm/nohash/64/pgtable.h | 2 ++ 4 files changed, 23 insertions(+) diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index c615abdce119..866b67a8abf0 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -294,7 +294,9 @@ static inline void __ptep_set_access_flags(struct mm_struct *mm, #define __swp_offset(entry) ((entry).val >> 5) #define __swp_entry(type, offset) ((swp_entry_t) { (type) | ((offset) << 5) }) #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 3 }) +#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pmd) >> 3 }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 3 }) +#define __swp_entry_to_pmd(x) ((pmd_t) { (x).val << 3 }) int map_kernel_page(unsigned long va, phys_addr_t pa, int flags); diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index a6b9f1d74600..6b3c6492071d 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -726,7 +726,9 @@ static inline bool pte_user(pte_t pte) * Clear bits not found in swap entries here. */ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) & ~_PAGE_PTE }) +#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val((pmd)) & ~_PAGE_PTE }) #define __swp_entry_to_pte(x) __pte((x).val | _PAGE_PTE) +#define __swp_entry_to_pmd(x) __pmd((x).val | _PAGE_PTE) #ifdef CONFIG_MEM_SOFT_DIRTY #define _PAGE_SWP_SOFT_DIRTY (1UL << (SWP_TYPE_BITS + _PAGE_BIT_SWAP_TYPE)) @@ -749,6 +751,21 @@ static inline pte_t pte_swp_clear_soft_dirty(pte_t pte) { return __pte(pte_val(pte) & ~_PAGE_SWP_SOFT_DIRTY); } + +static inline pmd_t pmd_swp_mksoft_dirty(pmd_t pmd) +{ + return __pmd(pmd_val(pmd) | _PAGE_SWP_SOFT_DIRTY); +} + +static inline bool pmd_swp_soft_dirty(pmd_t pmd) +{ + return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_SWP_SOFT_DIRTY)); +} + +static inline pmd_t pmd_swp_clear_soft_dirty(pmd_t pmd) +{ + return __pmd(pmd_val(pmd) & ~_PAGE_SWP_SOFT_DIRTY); +} #endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */ static inline bool check_pte_access(unsigned long access, unsigned long ptev) diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index 03bbd1149530..f6b0534a02d4 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -337,7 +337,9 @@ static inline void __ptep_set_access_flags(struct mm_struct *mm, #define __swp_offset(entry) ((entry).val >> 5) #define __swp_entry(type, offset) ((swp_entry_t) { (type) | ((offset) << 5) }) #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 3 }) +#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pte) >> 3 }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 3 }) +#define __swp_entry_to_pmd(x) ((pmd_t) { (x).val << 3 }) int map_kernel_page(unsigned long va, phys_addr_t pa, int flags); diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h index 5c5f75d005ad..5790763c07df 100644 --- a/arch/powerpc/include/asm/nohash/64/pgtable.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -342,7 +342,9 @@ static inline void __ptep_set_access_flags(struct mm_struct *mm, | ((offset) << PTE_RPN_SHIFT) }) #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) }) +#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val((pmd)) }) #define __swp_entry_to_pte(x) __pte((x).val) +#define __swp_entry_to_pmd(x) __pmd((x).val) extern int map_kernel_page(unsigned long ea, unsigned long pa, unsigned long flags); -- 2.17.0