From: Mike Rapoport <rppt@linux.ibm.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Christian Dietrich <stettberger@dokucode.de>
Subject: Re: [PATCH] mm: Remove checks for pte_index
Date: Sat, 19 Aug 2023 17:57:42 +0300 [thread overview]
Message-ID: <ZODYZo5+V8hyBeq8@linux.ibm.com> (raw)
In-Reply-To: <20230819031837.3160096-1-willy@infradead.org>
On Sat, Aug 19, 2023 at 04:18:37AM +0100, Matthew Wilcox (Oracle) wrote:
> Since pte_index is always defined, we don't need to check whether it's
> defined or not. Delete the slow version that doesn't depend on it and
> remove the #define since nobody needs to test for it.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Mike Rapoport <rppt@linux.ibm.com>
> Cc: Christian Dietrich <stettberger@dokucode.de>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
> include/linux/pgtable.h | 1 -
> mm/memory.c | 17 +----------------
> 2 files changed, 1 insertion(+), 17 deletions(-)
>
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index cb5c1fad1078..1fba072b3dac 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -66,7 +66,6 @@ static inline unsigned long pte_index(unsigned long address)
> {
> return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
> }
> -#define pte_index pte_index
>
> #ifndef pmd_index
> static inline unsigned long pmd_index(unsigned long address)
> diff --git a/mm/memory.c b/mm/memory.c
> index 2947fbc558f6..b7ce04cb058d 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1870,7 +1870,6 @@ static int insert_page(struct vm_area_struct *vma, unsigned long addr,
> return retval;
> }
>
> -#ifdef pte_index
> static int insert_page_in_batch_locked(struct vm_area_struct *vma, pte_t *pte,
> unsigned long addr, struct page *page, pgprot_t prot)
> {
> @@ -1885,7 +1884,7 @@ static int insert_page_in_batch_locked(struct vm_area_struct *vma, pte_t *pte,
> }
>
> /* insert_pages() amortizes the cost of spinlock operations
> - * when inserting pages in a loop. Arch *must* define pte_index.
> + * when inserting pages in a loop.
> */
> static int insert_pages(struct vm_area_struct *vma, unsigned long addr,
> struct page **pages, unsigned long *num, pgprot_t prot)
> @@ -1944,7 +1943,6 @@ static int insert_pages(struct vm_area_struct *vma, unsigned long addr,
> *num = remaining_pages_total;
> return ret;
> }
> -#endif /* ifdef pte_index */
>
> /**
> * vm_insert_pages - insert multiple pages into user vma, batching the pmd lock.
> @@ -1964,7 +1962,6 @@ static int insert_pages(struct vm_area_struct *vma, unsigned long addr,
> int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr,
> struct page **pages, unsigned long *num)
> {
> -#ifdef pte_index
> const unsigned long end_addr = addr + (*num * PAGE_SIZE) - 1;
>
> if (addr < vma->vm_start || end_addr >= vma->vm_end)
> @@ -1976,18 +1973,6 @@ int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr,
> }
> /* Defer page refcount checking till we're about to map that page. */
> return insert_pages(vma, addr, pages, num, vma->vm_page_prot);
> -#else
> - unsigned long idx = 0, pgcount = *num;
> - int err = -EINVAL;
> -
> - for (; idx < pgcount; ++idx) {
> - err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]);
> - if (err)
> - break;
> - }
> - *num = pgcount - idx;
> - return err;
> -#endif /* ifdef pte_index */
> }
> EXPORT_SYMBOL(vm_insert_pages);
>
> --
> 2.40.1
>
--
Sincerely yours,
Mike.
prev parent reply other threads:[~2023-08-19 15:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-19 3:18 [PATCH] mm: Remove checks for pte_index Matthew Wilcox (Oracle)
2023-08-19 14:57 ` Mike Rapoport [this message]
Reply instructions:
You may reply publicly 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=ZODYZo5+V8hyBeq8@linux.ibm.com \
--to=rppt@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=stettberger@dokucode.de \
--cc=willy@infradead.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.