Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4144390imm; Mon, 15 Oct 2018 09:45:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ry8RDkz2/nD8EpZ0iGaW7zZ2z/NKHkjFzpoBC0y75PA7gwA7I1qxVdC/MJyLUxcTb+vSZ X-Received: by 2002:a63:145f:: with SMTP id 31-v6mr16360168pgu.35.1539621958569; Mon, 15 Oct 2018 09:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539621958; cv=none; d=google.com; s=arc-20160816; b=CtEQjRRsA54YsXAGjy8N1AEBmxls/P1K/mlKJ5aIdL+/mmpRa4RBlc0g4m4381BDel 5oJlvhB+aGDXuGOEqNYZrOivCzDS2ddEjma0N7LR77AUsS0Al9SC9Hafk2w6qzeEZk/a 97IFa6Rx93D2p81g5O87QsIlBgOuGsnm9Y19nMCLbhimGp0i1/cM/ENJVofrSsOiMB55 nSKUN+XOqkIcfP/C4S12oW4uHZ913dMNVSHxPslTDYtmwQ/xtkvX03bD9l8yIkzst2tl LMmegg6hXnaLCviXunRvUCvY1ocH0w5gQ+d/tPaSEZD0wgg+8QtSTz4S3hERjTOxnc0i oE/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :message-id:references:in-reply-to:date:subject:cc:to:from; bh=ZdL44n1JUPf+c1JIzw+vN9g/+ptREVygpPDXPQQdW4g=; b=ZQg5fi/0plTRVRFvCMuo5Nb3LHGlWmF9LBQRRV47zQ9Jz24+eUnUndJxXKHI2d7AK0 XHdA3LXMnhDLZxI2gON3+Uo+DoL0rzI6yIa8BPGOpix4jCJ+M7g0Du6R9luSWuJohDWf 0UOaLbHOOqQro5x3HfYyF1EqZAbisqYqVKOnH7Up0V9g76JXwUYwEYiCul8899Phw0yM 8a6POS8TXerDhXY1oSCeqJYrtiSCU4Y0Yk/Z6iZIOl7D7e6musMeuHdjt7Xbtp0l6Kk5 RBZTCswtIjXV2h2s/gUJqATwJRYdDiOGDtHhD94Q21wt1w9pKEABIj85S3yuX4uIc15L UL6A== 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 g12-v6si10764686plt.4.2018.10.15.09.45.42; Mon, 15 Oct 2018 09:45:58 -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; 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 S1726880AbeJPA3B (ORCPT + 99 others); Mon, 15 Oct 2018 20:29:01 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48092 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbeJPA3B (ORCPT ); Mon, 15 Oct 2018 20:29:01 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9FGei8n064118 for ; Mon, 15 Oct 2018 12:43:00 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n4w7nv88j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 15 Oct 2018 12:42:59 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 15 Oct 2018 17:42:57 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 15 Oct 2018 17:42:53 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9FGgqSg4784628 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Oct 2018 16:42:52 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C31442045; Mon, 15 Oct 2018 19:42:26 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E5A94203F; Mon, 15 Oct 2018 19:42:26 +0100 (BST) Received: from mschwideX1.emea.ibm.com (unknown [9.145.33.55]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 15 Oct 2018 19:42:26 +0100 (BST) From: Martin Schwidefsky To: Li Wang , Guenter Roeck , Janosch Frank Cc: "Kirill A. Shutemov" , Heiko Carstens , linux-kernel , Linux-MM , Martin Schwidefsky Subject: [PATCH 1/3] mm: introduce mm_[p4d|pud|pmd]_folded Date: Mon, 15 Oct 2018 18:42:37 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539621759-5967-1-git-send-email-schwidefsky@de.ibm.com> References: <1539621759-5967-1-git-send-email-schwidefsky@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18101516-0012-0000-0000-000002B75875 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101516-0013-0000-0000-000020EBC9DC Message-Id: <1539621759-5967-2-git-send-email-schwidefsky@de.ibm.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-15_08:,, 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=703 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810150147 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add three architecture overrideable function to test if the p4d, pud, or pmd layer of a page table is folded or not. Signed-off-by: Martin Schwidefsky --- include/linux/mm.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 0416a7204be3..d1029972541c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -105,6 +105,46 @@ extern int mmap_rnd_compat_bits __read_mostly; #define mm_zero_struct_page(pp) ((void)memset((pp), 0, sizeof(struct page))) #endif +/* + * On some architectures it depends on the mm if the p4d/pud or pmd + * layer of the page table hierarchy is folded or not. + */ +#ifndef mm_p4d_folded +#define mm_p4d_folded(mm) mm_p4d_folded(mm) +static inline bool mm_p4d_folded(struct mm_struct *mm) +{ +#ifdef __PAGETABLE_P4D_FOLDED + return 1; +#else + return 0; +#endif +} +#endif + +#ifndef mm_pud_folded +#define mm_pud_folded(mm) mm_pud_folded(mm) +static inline bool mm_pud_folded(struct mm_struct *mm) +{ +#ifdef __PAGETABLE_PUD_FOLDED + return 1; +#else + return 0; +#endif +} +#endif + +#ifndef mm_pmd_folded +#define mm_pmd_folded(mm) mm_pmd_folded(mm) +static inline bool mm_pmd_folded(struct mm_struct *mm) +{ +#ifdef __PAGETABLE_PMD_FOLDED + return 1; +#else + return 0; +#endif +} +#endif + /* * Default maximum number of active map areas, this limits the number of vmas * per mm struct. Users can overwrite this number by sysctl but there is a -- 2.16.4