Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2101673ybx; Thu, 7 Nov 2019 23:26:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyjK85fayO0zu2mL4028yXfEd+exv3lLuWpErt+/VSkzKdyaP0qAitiu7uhNc15r7kliXGb X-Received: by 2002:a17:906:4056:: with SMTP id y22mr7483027ejj.188.1573197980249; Thu, 07 Nov 2019 23:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573197980; cv=none; d=google.com; s=arc-20160816; b=z5WSxG6vd+gMqPPsq88+ul89wqPEbTVidtYUwB56A/Ldvi8ybySRsJcTVzaEFz991Z raG+fBbdiF+znZXwyFo3uAKvHiwjfHYxdOwQ8NCuTOuigny1PvTCrUU8tFTxb9bg7Gs+ EQdibIsPvjwB0AHr9cFQEvwMrwzIQIOn3GVRSzzz6ikdRaWmRdHdNSwIHBdspHMehfBo baoX3Wl5hRFwiYV8/bigRZL0siexl00nxHtipNQGg3BVNkKZOx5dcU3sWQMBHt5m9SU4 n42OxHzpvcVhlZc12+QMJMuDVQ9CmKRFhRDfW0xpx3SXtvu7l5JcRcwc8T26mdPiw7PL G//A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aZt31Z8grhfzi23SdM9LJl0YetqCl+x1hzNaAJKV3DQ=; b=YEpsNKsS4UjWF3r/akSA0epdJf0YiU/MvWIcoXW9BdOEyTcTUCzHLJYdoReTLTm/rj 8oT6k22igGOwVpIWFkmVZ7Bxix8Qs3KQ/EwiAqTGsVs579c1i3/tRGtOSBuVpV0UvGPU ioz4DhJtkaEyRYcumPB6N3R5AJV+nIuxcGdgMf3LMR2p9PtkSY427ztc1Sxhcr3CIsuN D/WAslCH5w+5ldmcb6dHfpNQx1uotG7iFK0leerF+U0M1UFdMSsZ8jM84lZlcqQTq208 slW/MWwd9OCt+NUb9b0iO9UkiEzIOSzXN6PvMevLFREAaS1kWnIPh6uRtUa60uifvmQw DzbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=djxI05yK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e50si3519859ede.59.2019.11.07.23.25.56; Thu, 07 Nov 2019 23:26:20 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=djxI05yK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729770AbfKHHZY (ORCPT + 99 others); Fri, 8 Nov 2019 02:25:24 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:53076 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbfKHHZY (ORCPT ); Fri, 8 Nov 2019 02:25:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aZt31Z8grhfzi23SdM9LJl0YetqCl+x1hzNaAJKV3DQ=; b=djxI05yKFzfYUWz690/pwh+FC z5SIzw0jVzWgu11u+rNRF0jHfjJ5w7Phs23jsGiHHDbf8T549WvTzDDFNydvMxOU0tSrUbgmNXmuM 6p8sA1djPZH5tT0KHvBV3ecmQtuiD8bd8o0T/pN+a5ycRhtpdDEgMSI8VpASpH+1KFxKKApeKPUb7 xtcCj0+19CPcnabzov9FxCkjfo+13G/6+StoFNqLc2Y5q5nBydbSg9oIJpmcIcn/tvMFHE77Dv1Tu cPYXUOF1gcYSoWPEbmpGVkZyyWfPE/Qk1D0eFrx8gDX6g9mIcPv9+q92znp8iODivmS0s3jA+UTFb IXmrRSkTA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSye3-0006ea-Gc; Fri, 08 Nov 2019 07:25:23 +0000 Date: Thu, 7 Nov 2019 23:25:23 -0800 From: Christoph Hellwig To: Zong Li Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, paul.walmsley@sifive.com, palmer@sifive.com, Anup.Patel@wdc.com Subject: Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE Message-ID: <20191108072523.GA20338@infradead.org> References: <1572920412-15661-1-git-send-email-zong.li@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1572920412-15661-1-git-send-email-zong.li@sifive.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote: > uintptr_t map_size = PAGE_SIZE; > > - /* Upgrade to PMD/PGDIR mappings whenever possible */ > - if (!(base & (PTE_PARENT_SIZE - 1)) && > - !(size & (PTE_PARENT_SIZE - 1))) > - map_size = PTE_PARENT_SIZE; > + /* Upgrade to PMD_SIZE mappings whenever possible */ > + if (!(base & (PMD_SIZE - 1)) && > + !(size & (PMD_SIZE - 1))) > + map_size = PMD_SIZE; The check easily fits onto a single line now. Also the map_size variable is rather pointless. Why not: if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1))) return PAGE_SIZE; return PMD_SIZE;