Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Zong Li <zong.li@sifive.com>
Cc: Anup.Patel@wdc.com, linux-riscv@lists.infradead.org,
	palmer@sifive.com, linux-kernel@vger.kernel.org,
	paul.walmsley@sifive.com
Subject: Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
Date: Thu, 7 Nov 2019 23:25:23 -0800
Message-ID: <20191108072523.GA20338@infradead.org> (raw)
In-Reply-To: <1572920412-15661-1-git-send-email-zong.li@sifive.com>

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;

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  2:20 Zong Li
2019-11-05  3:21 ` Anup Patel
2019-11-06 19:00 ` Paul Walmsley
2019-11-08  7:25 ` Christoph Hellwig [this message]
2019-11-08  8:50   ` Zong Li

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108072523.GA20338@infradead.org \
    --to=hch@infradead.org \
    --cc=Anup.Patel@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=zong.li@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org
	public-inbox-index linux-riscv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git