Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp376109img; Thu, 28 Feb 2019 00:39:04 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib11mLEAmrmwql8tPWD3nqC0osyI8XyMuozWJgzAgQfN+8iDocHRvzCMurczwE8UTNQXHUU X-Received: by 2002:a63:8048:: with SMTP id j69mr7301346pgd.432.1551343144811; Thu, 28 Feb 2019 00:39:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551343144; cv=none; d=google.com; s=arc-20160816; b=V+5Bz2nGig49gRhOvk6S6xq1Rol0aaKVIp0eRB22xukZRd5oBEB/I0f73roAjmleI/ eD2sVHazK07fhcNjGs706ZJ4k3DjDOdRNvUJukBm0/ceyAfPWkx48cPjgQ5Gcat3HB4+ q1isklQPU8h3E7BOFWuy/H7WTfhv7qXupKNIV4KkD0RpxBZnbyYeNC10GyvtMNiHWn5d Hxr+J64Y6s339cEccr5ofKJlYEHQtYKM79YPnY4SR8o3u2Lmy4trOCHm9dd45becjWuk Egb5aUwN9ZKje99tGX/7ifMscRB4fRX4REwCW6/u42bAUdTnFDskWKTfRFBhGUJ2bF2V 1wmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=jJVa2qV8nKvE2yQie1WFcZW7O3Eubx1M5bJjeVzZStM=; b=ZDktTSAi5NOv23dROeySr8p3oVF64l0dPuSzAxfsCd4tywwxSznS6WWlDgXe3gHFlo 1qFTL8AszdXc0q6Ft9mOQ2NLOmGg6fBErR6xJJ1bUtyeEPX1OBztmtWyH1t4xAoDwZfj 0w6yXOUMGhcPKzH6Pwh2VK+EBEJwCTlyzZ31CpG7AjAIg0YirB+sfEduWWvQxa+3TdyY uR5bhYcIRqFUW7nlgpYJ0SA1juqKSfhHa7CNgPCxs9omCxvG6CBEiO1WeAXRRX6ohvks fJim/Up3Z3yOWp/GLJgtXUSQ+F3r1f5SGYjBa3nGMP8zCl1zVP0bj12s7S9cKC+iAuCl y5fg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j29si11577452pgi.449.2019.02.28.00.38.49; Thu, 28 Feb 2019 00:39:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731818AbfB1Ifp (ORCPT + 99 others); Thu, 28 Feb 2019 03:35:45 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45578 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725999AbfB1Ifo (ORCPT ); Thu, 28 Feb 2019 03:35:44 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1S8Y8UY078246 for ; Thu, 28 Feb 2019 03:35:43 -0500 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qx8w0gefs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Feb 2019 03:35:42 -0500 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Feb 2019 08:35:41 -0000 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 28 Feb 2019 08:35:37 -0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1S8ZaHx23134358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Feb 2019 08:35:36 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 890977805C; Thu, 28 Feb 2019 08:35:36 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFA3A7805F; Thu, 28 Feb 2019 08:35:33 +0000 (GMT) Received: from skywalker.in.ibm.com (unknown [9.124.31.233]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 28 Feb 2019 08:35:33 +0000 (GMT) From: "Aneesh Kumar K.V" To: akpm@linux-foundation.org, "Kirill A . Shutemov" , Jan Kara , mpe@ellerman.id.au, Ross Zwisler , "Oliver O'Halloran" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Subject: [PATCH 2/2] mm/dax: Don't enable huge dax mapping by default Date: Thu, 28 Feb 2019 14:05:22 +0530 X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228083522.8189-1-aneesh.kumar@linux.ibm.com> References: <20190228083522.8189-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19022808-0004-0000-0000-000014E81B12 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010678; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000281; SDB=6.01167493; UDB=6.00609930; IPR=6.00948106; MB=3.00025776; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-28 08:35:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19022808-0005-0000-0000-00008ABEE271 Message-Id: <20190228083522.8189-2-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-28_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902280061 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a flag to indicate the ability to do huge page dax mapping. On architecture like ppc64, the hypervisor can disable huge page support in the guest. In such a case, we should not enable huge page dax mapping. This patch adds a flag which the architecture code will update to indicate huge page dax mapping support. Architectures mostly do transparent_hugepage_flag = 0; if they can't do hugepages. That also takes care of disabling dax hugepage mapping with this change. Without this patch we get the below error with kvm on ppc64. [ 118.849975] lpar: Failed hash pte insert with error -4 NOTE: The patch also use echo never > /sys/kernel/mm/transparent_hugepage/enabled to disable dax huge page mapping. Signed-off-by: Aneesh Kumar K.V --- TODO: * Add Fixes: tag include/linux/huge_mm.h | 4 +++- mm/huge_memory.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 381e872bfde0..01ad5258545e 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -53,6 +53,7 @@ vm_fault_t vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, pud_t *pud, pfn_t pfn, bool write); enum transparent_hugepage_flag { TRANSPARENT_HUGEPAGE_FLAG, + TRANSPARENT_HUGEPAGE_DAX_FLAG, TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, @@ -111,7 +112,8 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_FLAG)) return true; - if (vma_is_dax(vma)) + if (vma_is_dax(vma) && + (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_DAX_FLAG))) return true; if (transparent_hugepage_flags & diff --git a/mm/huge_memory.c b/mm/huge_memory.c index faf357eaf0ce..43d742fe0341 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -53,6 +53,7 @@ unsigned long transparent_hugepage_flags __read_mostly = #ifdef CONFIG_TRANSPARENT_HUGEPAGE_MADVISE (1<