From patchwork Wed Jul 25 16:19:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 10544285 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 4A14A139A for ; Wed, 25 Jul 2018 16:19:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 386722A409 for ; Wed, 25 Jul 2018 16:19:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C8F02A5BD; Wed, 25 Jul 2018 16:19:31 +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 A76FE2A409 for ; Wed, 25 Jul 2018 16:19:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4144E6B000C; Wed, 25 Jul 2018 12:19:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3C60C6B000D; Wed, 25 Jul 2018 12:19:29 -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 266EA6B000E; Wed, 25 Jul 2018 12:19:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id B91216B000C for ; Wed, 25 Jul 2018 12:19:28 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id f8-v6so3319010eds.6 for ; Wed, 25 Jul 2018 09:19:28 -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; bh=DtE+6njeqUAnvrqy6u+uinFRfQwK5Qw8zLxMquiDQQ4=; b=BWo4G83iMo4CSLjKW72qUIaq8v8T1dI+BWpYHva56z7MbOZ27mFtywHt3bzT2wA3n7 jwdWga/9OngpBZMqyg9vn2X+VYcmoavtdSOA69/fegBT7XGUlr2RU2ragiltMzVONqu8 Zq9QHVPuzS6/0E7oxi0oRDRfRiwZPe5D/sY6Z+wOeMOIxV7IrAu2kCxfoWbftwoko9qv FOXnPSGKVJlNVVsTTE5SEidc9CxXEzDZbrxzmLj3BiFQEe3yqX/ip5lvyjB7STr39UWK SmwGm5qQFrqCqKq9ggi8TAf+3DZ3bdXywXzeWzLX83zlXngOZCnPj7jJ2ZjY6R00EwTk QIQQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AOUpUlGDAsnHJrKTdmTy/0iuyQuQLVtZm0a1HBpg/crGhwyeyT6Hw1QU 0jwdUwFD44v7PxDOwz8eOrhqoNIqQYUw8/jM6AJz9cZ9S/FlN9EoOeKMpEWyRZTczBSx6L+JFLn PrfchrAqqi5pTCXokU4qXMgMnHwHUOIV/5f/kYVrub7PQmpVvtDnYXzupEHCowOXvow== X-Received: by 2002:a50:afc4:: with SMTP id h62-v6mr23600049edd.251.1532535568314; Wed, 25 Jul 2018 09:19:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeI+T2hcmzLEkRqJBmGq69zN20rndxjq66tTLhv4SgroBxIEKIdU0vcUiH5e4788p57BCLY X-Received: by 2002:a50:afc4:: with SMTP id h62-v6mr23600005edd.251.1532535567586; Wed, 25 Jul 2018 09:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532535567; cv=none; d=google.com; s=arc-20160816; b=sfxzcLsZnZW0VLkHYhbcsJ+dZTxnYJw9rggddQtMsc4JVpQMUIj9KzAHGgcJIjc8vP 0zSpMZGurK27FSkBijvUBgQo8XF9yN2J+XCocRWLrk73VsxD08m9c7B3FgH8t/cEHGOD uLMjKCmHiqYE8fu/aEkmyfbbc3t23n5z9USpsK82yakPd16adzwWwKiwfvtlUBjaJaWa 1BGYlYIQfvW/aE+o9dv3t3NYLJ9ooqzhNvv7mZDQMCIrMS4yZkycD54zt5DyrOE8Lf5j 3lV72aWv/G/5K0Nm7a+oHnUuXl3JrDEBYliHSxgnDFNQmyIiDFylWXo/evgZ7QbgV30c 8IJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=DtE+6njeqUAnvrqy6u+uinFRfQwK5Qw8zLxMquiDQQ4=; b=aGXWBdUVyEQFsXI25bqPg4HZklXpSE0wq4dZeekgZwigX7i+zr4abItR26MsDvhVc4 Jj8uSOmF6WK3RbEQDWDACneaN4PkoClJIKuBK4M618+VFSQEAGJsbiruDQvFc84OuNqE PZ7/0Swj/99ES0kmvUfxZtkBlOIzryMt44TGtIXZgZc6B4r4EhOSsfVAEGjK2LcKsi9U aRORZgQALdiS5ZgOAnYZGgvJsfFj+A2l1J5WJBQ4VQKnSHJ3KJ2le130pG/zI6gBv95V /wrcRLC7b2D6DRnCiaTcxge58pQTJFNaPGt0JEbqNfohaYptUewtJkb6M2K4FDBjo2ov Qx9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id b24-v6si4385723edj.131.2018.07.25.09.19.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 09:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6PGEN4X008009 for ; Wed, 25 Jul 2018 12:19:25 -0400 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kevj206rf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Jul 2018 12:19:25 -0400 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2018 12:19:24 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 25 Jul 2018 12:19:21 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6PGJKZL58327116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Jul 2018 16:19:20 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56209AE05F; Wed, 25 Jul 2018 12:18:35 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA6A6AE05C; Wed, 25 Jul 2018 12:18:32 -0400 (EDT) Received: from skywalker.ibmmodules.com (unknown [9.199.35.55]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 25 Jul 2018 12:18:32 -0400 (EDT) From: "Aneesh Kumar K.V" To: npiggin@gmail.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, Naoya Horiguchi Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, "Aneesh Kumar K.V" Subject: [PATCH V2 3/6] powerpc/mm/book3s: Check for pmd_large instead of pmd_trans_huge Date: Wed, 25 Jul 2018 21:49:00 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180725161903.31257-1-aneesh.kumar@linux.ibm.com> References: <20180725161903.31257-1-aneesh.kumar@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18072516-0072-0000-0000-00000385A95A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009425; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01065989; UDB=6.00547631; IPR=6.00843848; MB=3.00022321; MTD=3.00000008; XFM=3.00000015; UTC=2018-07-25 16:19:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072516-0073-0000-0000-000048D76DEB Message-Id: <20180725161903.31257-3-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-25_03:,, 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-1806210000 definitions=main-1807250174 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 Update few code paths to check for pmd_large. set_pmd_at: We want to use this to store swap pte at pmd level. For swap ptes we don't want to set H_PAGE_THP_HUGE. Hence check for pmd_large in set_pmd_at. This remove the false WARN_ON when using this with swap pmd entry. pmd_page: We don't really use them on pmd migration entries. But they can also work with migration entries and we don't differentiate at the pte level. Hence update pmd_page to work with pmd migration entries too __find_linux_pte: lockless page table walk need to handle pmd migration entries. pmd_trans_huge check will return false on them. We don't set thp = 1 for such entries, but update hpage_shift correctly. Without this we will walk pmd migration entries as a pte page pointer which is wrong. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/hugetlbpage.c | 8 ++++++-- arch/powerpc/mm/pgtable-book3s64.c | 2 +- arch/powerpc/mm/pgtable_64.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 7ae5e4bfd318..80fdeec89698 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -846,8 +846,12 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea, ret_pte = (pte_t *) pmdp; goto out; } - - if (pmd_huge(pmd)) { + /* + * pmd_large check below will handle the swap pmd pte + * we need to do both the check because they are config + * dependent. + */ + if (pmd_huge(pmd) || pmd_large(pmd)) { ret_pte = (pte_t *) pmdp; goto out; } else if (is_hugepd(__hugepd(pmd_val(pmd)))) diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c index 24346ab4cd37..16d963f281a3 100644 --- a/arch/powerpc/mm/pgtable-book3s64.c +++ b/arch/powerpc/mm/pgtable-book3s64.c @@ -71,7 +71,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, #ifdef CONFIG_DEBUG_VM WARN_ON(pte_present(pmd_pte(*pmdp)) && !pte_protnone(pmd_pte(*pmdp))); assert_spin_locked(pmd_lockptr(mm, pmdp)); - WARN_ON(!(pmd_trans_huge(pmd) || pmd_devmap(pmd))); + WARN_ON(!(pmd_large(pmd) || pmd_devmap(pmd))); #endif trace_hugepage_set_pmd(addr, pmd_val(pmd)); return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd)); diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index 53e9eeecd5d4..e15e63079ba8 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c @@ -306,7 +306,7 @@ struct page *pud_page(pud_t pud) */ struct page *pmd_page(pmd_t pmd) { - if (pmd_trans_huge(pmd) || pmd_huge(pmd) || pmd_devmap(pmd)) + if (pmd_large(pmd) || pmd_huge(pmd) || pmd_devmap(pmd)) return pte_page(pmd_pte(pmd)); return virt_to_page(pmd_page_vaddr(pmd)); }