From patchwork Wed Oct 31 12:59:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Schwidefsky X-Patchwork-Id: 10662621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 641B913BF for ; Wed, 31 Oct 2018 13:00:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5449D2AD31 for ; Wed, 31 Oct 2018 13:00:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48A9B2AD4F; Wed, 31 Oct 2018 13:00:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC74A2AD62 for ; Wed, 31 Oct 2018 13:00:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E34866B028C; Wed, 31 Oct 2018 09:00:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DE4D06B028E; Wed, 31 Oct 2018 09:00:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5F316B02A5; Wed, 31 Oct 2018 09:00:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by kanga.kvack.org (Postfix) with ESMTP id 9E84B6B028C for ; Wed, 31 Oct 2018 09:00:12 -0400 (EDT) Received: by mail-ot1-f71.google.com with SMTP id v4so11213471otb.0 for ; Wed, 31 Oct 2018 06:00:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id :content-transfer-encoding:mime-version; bh=yhE4u3X/tQFwffZaYgepsoYyy9MKw/Mept85mU7FSQU=; b=qYrDj1AG9Bbze3Bg3ME8qgbM+VjEBZJuti7zyCL+dwFU7iOPOXCpKIAYJ55ejKj+AD AafhcIF24Ux7P4qth2Sw5fhnYI3BKN5gX4Sfv9A/QU0w5UeEtS/aWT1kkKf6Sv3g9e9Q pGSJ25R5d2v66saSeecOor4FxLlJTsmQB8GxLCwxWK9i3XlQw0mV2rRtg3UBz34UEb7C GbJjqLJmQoc35b3HPl8qfPKLko0tOXbq8/bbiFPgUE4+IDGTz+htKws+U+7VeXGUM0Pa HY65urSwbXP3yUzAuY5PLlzc90130ihMH16zzdDhiCzhxgs/CMQnaPLH57HOor7zCp9Q Cy2A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of schwidefsky@de.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=schwidefsky@de.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AGRZ1gLMcA4LYNODwdiG7l5WSOiVUU+HNYN0qL3x56Euy9CyyW/0hzLB 83va7YlBrQHGXuLzBgQ3jbX3acopq2XohwxpWU1FUUhaf5xnFckEeKNLdCWVjR/WD0WbTt9V1MT 07TIa7XsPNczvrY1aFYQOB/wuvXOlHbKeTHXgK2xJGWjYcR8kaI4na+ePp3tOQKgWuw== X-Received: by 2002:a9d:2be4:: with SMTP id u91mr1913356ota.289.1540990812359; Wed, 31 Oct 2018 06:00:12 -0700 (PDT) X-Google-Smtp-Source: AJdET5ccm2tfMLIEPCBZ1MCZ8az0nbd/sCv5VMZNekXK7IIu5JhXQMVD7sEMJAuy3HTLFfrCqR5b X-Received: by 2002:a9d:2be4:: with SMTP id u91mr1913298ota.289.1540990811418; Wed, 31 Oct 2018 06:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540990811; cv=none; d=google.com; s=arc-20160816; b=IGjZJhdCYMRylODwMXlCQrz6jlD8GqOsZOqRJqDetkYccZ4+I4TkgMdfwFU2L5Kltt QECTuy0tcPmNJtw2MNnupJxZHH4qe3qvInj8qyrxRv/E4qPHybhyVdog+ZcqejkBqghO NBCbsDigBcRasRw/lHzW0hx7/m+CnIEKoymRdtShyT9JEIXQZ1EQQVgMcBiF828eXNeh +NYzJKWZaEuAjYM4t8/ZtjVz5c/Sn4ljTkcKFyiktKTLWjQcm0T/HypRivqAkSApdvG1 gycigdZtdKdfesoFfmzAqojnddURZrMQD0JPPFfCX9/VIdAxAz3YEd3XM3P4hLGr+M6G lUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:message-id:references :in-reply-to:date:subject:cc:to:from; bh=yhE4u3X/tQFwffZaYgepsoYyy9MKw/Mept85mU7FSQU=; b=xuMHzmScKfWBJUNwi8A5XRQUqd+aBZxYW7tgH+W1B0EThgf++E+8A3KtJVsl0gDK+q mwLSNXmuMruY1vY78xyXEw7FrgUiSgvoKO/EortqWZgk5JQtbxBesfkpGaPKQFAxlvTW OeuNNiUUY6cOQ6wrpNbRCi9ezA7MCbYTeG5J5oJCEqciptwqXfjaJXDkdwqoRUDQQR6A PYa36Nac+HlBCUCP81qL5YfQqrfb9Vi3CNFGmeQyUh6bYDvyVY4sj9HC7wFRIGMfpktn HTFSfx4jL/9xSQRSAmoTS/U+FfD0p1szK13rSJrafrgCUk7IKFu7r1JAleC7Qai6k64H a0OQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of schwidefsky@de.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=schwidefsky@de.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id z36si1609483ota.0.2018.10.31.06.00.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 06:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of schwidefsky@de.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of schwidefsky@de.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=schwidefsky@de.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9VCx4Ke034576 for ; Wed, 31 Oct 2018 09:00:10 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nfcuur3be-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 31 Oct 2018 09:00:10 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 31 Oct 2018 13:00:08 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 31 Oct 2018 13:00:06 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9VD05a066125956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 31 Oct 2018 13:00:05 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01A3B11C052; Wed, 31 Oct 2018 13:00:05 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B346D11C04C; Wed, 31 Oct 2018 13:00:04 +0000 (GMT) Received: from mschwideX1.boeblingen.de.ibm.com (unknown [9.152.212.164]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 31 Oct 2018 13:00:04 +0000 (GMT) From: Martin Schwidefsky To: Li Wang , Guenter Roeck , Janosch Frank , "Kirill A. Shutemov" , Heiko Carstens , linux-kernel , Linux-MM Cc: Martin Schwidefsky Subject: [PATCH 2/4] mm: introduce mm_[p4d|pud|pmd]_folded Date: Wed, 31 Oct 2018 13:59:59 +0100 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540990801-4261-1-git-send-email-schwidefsky@de.ibm.com> References: <1540990801-4261-1-git-send-email-schwidefsky@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18103113-4275-0000-0000-000002D714B6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18103113-4276-0000-0000-000037E41C68 Message-Id: <1540990801-4261-3-git-send-email-schwidefsky@de.ibm.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-31_05:,, 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=573 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310109 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Add three architecture overrideable functions to test if the p4d, pud, or pmd layer of a page table is folded or not. Signed-off-by: Martin Schwidefsky Acked-by: Kirill A. Shutemov --- include/asm-generic/pgtable.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 5657a20..359fb93 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1127,4 +1127,20 @@ static inline bool arch_has_pfn_modify_check(void) #endif #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) __is_defined(__PAGETABLE_P4D_FOLDED) +#endif + +#ifndef mm_pud_folded +#define mm_pud_folded(mm) __is_defined(__PAGETABLE_PUD_FOLDED) +#endif + +#ifndef mm_pmd_folded +#define mm_pmd_folded(mm) __is_defined(__PAGETABLE_PMD_FOLDED) +#endif + #endif /* _ASM_GENERIC_PGTABLE_H */