linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm <linux-mm@kvack.org>,
	 "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	 "Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [PATCH 3/6] mm: Remove CONFIG_TRANSPARENT_HUGE_PAGECACHE
Date: Tue, 3 Mar 2020 13:52:10 -0800	[thread overview]
Message-ID: <CAKgT0UfboqXD2RagoJrTP7eGC25qBxtpyJ0K7kfG4J=y=D6rtQ@mail.gmail.com> (raw)
In-Reply-To: <20200303041125.19358-4-willy@infradead.org>

On Mon, Mar 2, 2020 at 8:11 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
>
> Commit e496cf3d7821 ("thp: introduce CONFIG_TRANSPARENT_HUGE_PAGECACHE")
> notes that it should be reverted when the PowerPC problem was fixed.
> The commit fixing the PowerPC problem (953c66c2b22a) did not revert
> the commit; instead setting CONFIG_TRANSPARENT_HUGE_PAGECACHE to the
> same as CONFIG_TRANSPARENT_HUGEPAGE.  Checking with Kirill and Aneesh,
> this was an oversight, so remove the Kconfig symbol and undo the work
> of commit e496cf3d7821.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  include/linux/shmem_fs.h | 10 +---------
>  mm/Kconfig               |  6 +-----
>  mm/huge_memory.c         |  2 +-
>  mm/khugepaged.c          | 10 ++--------
>  mm/memory.c              |  5 ++---
>  mm/rmap.c                |  2 +-
>  mm/shmem.c               | 36 ++++++++++++++++++------------------
>  7 files changed, 26 insertions(+), 45 deletions(-)
>
> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
> index d56fefef8905..7a35a6901221 100644
> --- a/include/linux/shmem_fs.h
> +++ b/include/linux/shmem_fs.h
> @@ -78,6 +78,7 @@ extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
>  extern int shmem_unuse(unsigned int type, bool frontswap,
>                        unsigned long *fs_pages_to_unuse);
>
> +extern bool shmem_huge_enabled(struct vm_area_struct *vma);
>  extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
>  extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
>                                                 pgoff_t start, pgoff_t end);
> @@ -114,15 +115,6 @@ static inline bool shmem_file(struct file *file)
>  extern bool shmem_charge(struct inode *inode, long pages);
>  extern void shmem_uncharge(struct inode *inode, long pages);
>
> -#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
> -extern bool shmem_huge_enabled(struct vm_area_struct *vma);
> -#else
> -static inline bool shmem_huge_enabled(struct vm_area_struct *vma)
> -{
> -       return false;
> -}
> -#endif
> -
>  #ifdef CONFIG_SHMEM
>  extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
>                                   struct vm_area_struct *dst_vma,

<snip>

> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index b679908743cb..f99ac65271aa 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -416,8 +416,6 @@ static bool hugepage_vma_check(struct vm_area_struct *vma,
>             (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) &&
>              vma->vm_file &&
>              (vm_flags & VM_DENYWRITE))) {
> -               if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGE_PAGECACHE))
> -                       return false;
>                 return IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
>                                 HPAGE_PMD_NR);
>         }
> @@ -1260,7 +1258,7 @@ static void collect_mm_slot(struct mm_slot *mm_slot)
>         }
>  }
>
> -#if defined(CONFIG_SHMEM) && defined(CONFIG_TRANSPARENT_HUGE_PAGECACHE)
> +#ifdef CONFIG_SHMEM
>  /*
>   * Notify khugepaged that given addr of the mm is pte-mapped THP. Then
>   * khugepaged should try to collapse the page table.
> @@ -1986,14 +1984,10 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
>                                   khugepaged_scan.address + HPAGE_PMD_SIZE >
>                                   hend);
>                         if (IS_ENABLED(CONFIG_SHMEM) && vma->vm_file) {
> -                               struct file *file;
> +                               struct file *file = get_file(vma->vm_file);
>                                 pgoff_t pgoff = linear_page_index(vma,
>                                                 khugepaged_scan.address);
>
> -                               if (shmem_file(vma->vm_file)
> -                                   && !shmem_huge_enabled(vma))
> -                                       goto skip;
> -                               file = get_file(vma->vm_file);
>                                 up_read(&mm->mmap_sem);
>                                 ret = 1;
>                                 khugepaged_scan_file(mm, file, pgoff, hpage);

In the code above you didn't eliminate shmem_huge_enabled, it still
exists and has multiple paths that can return false. Are we guaranteed
that it will return true or is it that it can be ignored here?

All the other changes look correct.


  reply	other threads:[~2020-03-03 21:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  4:11 [PATCH 0/6] Misc MM patches Matthew Wilcox
2020-03-03  4:11 ` [PATCH 1/6] mm: Use vm_fault error code directly Matthew Wilcox
2020-03-03  4:11 ` [PATCH 2/6] mm: Optimise find_subpage for !THP Matthew Wilcox
2020-03-03 21:28   ` Alexander Duyck
2020-03-03 21:47     ` Matthew Wilcox
2020-03-05  9:54       ` William Kucharski
2020-03-03  4:11 ` [PATCH 3/6] mm: Remove CONFIG_TRANSPARENT_HUGE_PAGECACHE Matthew Wilcox
2020-03-03 21:52   ` Alexander Duyck [this message]
2020-03-03 22:34     ` Matthew Wilcox
2020-03-03 22:54       ` Alexander Duyck
2020-03-04  2:06         ` Matthew Wilcox
2020-03-03  4:11 ` [PATCH 4/6] mm: Use VM_BUG_ON_PAGE in clear_page_dirty_for_io Matthew Wilcox
2020-03-03  4:11 ` [PATCH 5/6] mm: Unexport find_get_entry Matthew Wilcox
2020-03-03  4:11 ` [PATCH 6/6] mm: Rewrite pagecache_get_page documentation Matthew Wilcox

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='CAKgT0UfboqXD2RagoJrTP7eGC25qBxtpyJ0K7kfG4J=y=D6rtQ@mail.gmail.com' \
    --to=alexander.duyck@gmail.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).