Re: [PATCH mm] mm: Bring sparc pte_index() semantics inline with other platforms.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arjun,

On Fri, 21 Feb 2020 13:17:07 -0800 Arjun Roy <arjunroy.kdev@xxxxxxxxx> wrote:
>
> From: Arjun Roy <arjunroy@xxxxxxxxxx>
> 
> pte_index() on platforms other than sparc return a numerical index.
> On sparc, it returns a pte_t*. This presents an issue for
> vm_insert_pages(), which relies on pte_index() to find the offset for
> a pte within a pmd, for batched inserts.
> 
> This patch:
> 1. Modifies pte_index() for sparc to return a numerical index, like
>    other platforms,
> 2. Defines pte_entry() for sparc which returns a pte_t*
>    (as pte_index() used to),

I wonder if you should not just make pte_offset_kernel() do what the
old pte_index() did (this seems to align with what other arches do) and
then make pte_offset_map() be defined to be pte_offset_kernel.

> -#define pte_index(dir, address)	\
> -	((pte_t *) __pmd_page(*(dir)) + \
> -	 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
> -#define pte_offset_kernel		pte_index
> -#define pte_offset_map			pte_index
> +#define pte_index(address)	\
> +	 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
> +#define pte_entry(dir, address)	\
> +	((pte_t *) __pmd_page(*(dir)) + pte_index(address))
> +#define pte_offset_kernel		pte_entry
> +#define pte_offset_map			pte_entry

#define pte_offset_kernel(dir, address)	\
	((pte_t *) __pmd_page(*(dir)) + pte_index(address))
#define pte_offset_map(dir, address)	pte_offset_kernel((dir), (address))

-- 
Cheers,
Stephen Rothwell

Attachment: pgpqjLScC605L.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux