Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp319321pxk; Thu, 24 Sep 2020 06:33:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcOPH0Ka27KkCdiHaKmdHyB7gBdRpIszO3G4XyorFxUNiCqIE29rVV4zDLKBy9Z+xyEXa1 X-Received: by 2002:a17:906:4e82:: with SMTP id v2mr1148934eju.218.1600954391216; Thu, 24 Sep 2020 06:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600954391; cv=none; d=google.com; s=arc-20160816; b=s8/i//q0Fw3JeNbltlRLi3bknGOwoO29rCGXDRMby9T7BvjCWTO4jbWSeM2aMNdXPE emlfZvqNBZDPaS4JMWz4BLTE1zql0wHDB5NOeKkOMXiCEHP/jbNH1Qj9b5DJKIS+xeeG Zn5Gi5cx0kWL5859y9fbQelrH9iOpEj+BhRCWzuR7al+MG6HnR/k57XGg1ai4H7pECfG Ki+TKEFDk2GBs88RkV/OZGbBvpyBZIOwb7OrgrFGzoPHcc1PmiIZdMQ3b/OhWlXEi9IP 6YtjK6aUug0gfHnGRpACes9VpFquhzqSnNL0nCmzltH0vJyscxj40UQ01oKJ0LXwhkb2 46Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l9Vqjq5AVwKH9xvgJL+fPF6H3MfuFgtzpS9Y3AQXQAI=; b=bzWo4nMfot2v3Z5lX8Bb2BhPfKdyESSke4pg9FvW48KNDM2xY69De2OWlvpmXtsXAK 8oiuD54y4WtjBeZakd+sr45zvMXY6VlRwBPjyzGC2vHJYAD2CfiyecX+xO2mTFN5cPBp dWAD7wB6NpmC8gvLgYQUL3Lybi3BJMwruMUo4riI3tCnJIowQV06KezmbzxOTO8sLUub 01BqOtfCWCNVG96eJkE6C5O/e9j0ivWCoFAXm8ojZgjGEAoJZVLQwBp9zP+/IdKd1hUk 1VbqZFPBpTLvmyoSPvsIyUrAqrCRUfxBjwCECRMXpFpUav/svKVK75cYIW9bae4Am7ya 7ehg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SctItSWY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si2144032edx.256.2020.09.24.06.32.47; Thu, 24 Sep 2020 06:33:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SctItSWY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbgIXN3e (ORCPT + 99 others); Thu, 24 Sep 2020 09:29:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:49752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727795AbgIXN3d (ORCPT ); Thu, 24 Sep 2020 09:29:33 -0400 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CD992344C; Thu, 24 Sep 2020 13:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600954173; bh=RS/S5Ylr1E5JO8x8/BQ35wP+NdhJenOz2B47Vap/Jzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SctItSWYSjVnZZHThfvGYMvtIPIkq+1VVfeu4pNaKBgGoFW2LxYAlntCIFFsUuBVW mBOdM+KDyJ1TLvIuO1eTkBEj4QKdri1PFf8MELAhxFaLy7gR96gqF+1v//RtKfBxj2 wNFAzvwhzUE0DvW6q5W99RezmuwNkpeMu6saq25c= From: Mike Rapoport To: Andrew Morton Cc: Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , David Hildenbrand , Elena Reshetova , "H. Peter Anvin" , Idan Yaniv , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Mike Rapoport , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Thomas Gleixner , Shuah Khan , Tycho Andersen , Will Deacon , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-riscv@lists.infradead.org, x86@kernel.org Subject: [PATCH v6 1/6] mm: add definition of PMD_PAGE_ORDER Date: Thu, 24 Sep 2020 16:28:59 +0300 Message-Id: <20200924132904.1391-2-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924132904.1391-1-rppt@kernel.org> References: <20200924132904.1391-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport The definition of PMD_PAGE_ORDER denoting the number of base pages in the second-level leaf page is already used by DAX and maybe handy in other cases as well. Several architectures already have definition of PMD_ORDER as the size of second level page table, so to avoid conflict with these definitions use PMD_PAGE_ORDER name and update DAX respectively. Signed-off-by: Mike Rapoport --- fs/dax.c | 11 ++++------- include/linux/pgtable.h | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 994ab66a9907..c0b9aa4bda9e 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -49,9 +49,6 @@ static inline unsigned int pe_order(enum page_entry_size pe_size) #define PG_PMD_COLOUR ((PMD_SIZE >> PAGE_SHIFT) - 1) #define PG_PMD_NR (PMD_SIZE >> PAGE_SHIFT) -/* The order of a PMD entry */ -#define PMD_ORDER (PMD_SHIFT - PAGE_SHIFT) - static wait_queue_head_t wait_table[DAX_WAIT_TABLE_ENTRIES]; static int __init init_dax_wait_table(void) @@ -98,7 +95,7 @@ static bool dax_is_locked(void *entry) static unsigned int dax_entry_order(void *entry) { if (xa_to_value(entry) & DAX_PMD) - return PMD_ORDER; + return PMD_PAGE_ORDER; return 0; } @@ -1455,7 +1452,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp, { struct vm_area_struct *vma = vmf->vma; struct address_space *mapping = vma->vm_file->f_mapping; - XA_STATE_ORDER(xas, &mapping->i_pages, vmf->pgoff, PMD_ORDER); + XA_STATE_ORDER(xas, &mapping->i_pages, vmf->pgoff, PMD_PAGE_ORDER); unsigned long pmd_addr = vmf->address & PMD_MASK; bool write = vmf->flags & FAULT_FLAG_WRITE; bool sync; @@ -1514,7 +1511,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp, * entry is already in the array, for instance), it will return * VM_FAULT_FALLBACK. */ - entry = grab_mapping_entry(&xas, mapping, PMD_ORDER); + entry = grab_mapping_entry(&xas, mapping, PMD_PAGE_ORDER); if (xa_is_internal(entry)) { result = xa_to_internal(entry); goto fallback; @@ -1680,7 +1677,7 @@ dax_insert_pfn_mkwrite(struct vm_fault *vmf, pfn_t pfn, unsigned int order) if (order == 0) ret = vmf_insert_mixed_mkwrite(vmf->vma, vmf->address, pfn); #ifdef CONFIG_FS_DAX_PMD - else if (order == PMD_ORDER) + else if (order == PMD_PAGE_ORDER) ret = vmf_insert_pfn_pmd(vmf, pfn, FAULT_FLAG_WRITE); #endif else diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index e8cbc2e795d5..b0389078df39 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -28,6 +28,9 @@ #define USER_PGTABLES_CEILING 0UL #endif +/* Number of base pages in a second level leaf page */ +#define PMD_PAGE_ORDER (PMD_SHIFT - PAGE_SHIFT) + /* * A page table page can be thought of an array like this: pXd_t[PTRS_PER_PxD] * -- 2.28.0