All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-mm@kvack.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH v2 3/8] mm: Check PageTail in hpage_nr_pages even when !THP
Date: Wed, 18 Mar 2020 07:02:48 -0700	[thread overview]
Message-ID: <20200318140253.6141-4-willy@infradead.org> (raw)
In-Reply-To: <20200318140253.6141-1-willy@infradead.org>

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

It's even more important to check that we don't have a tail page when
calling hpage_nr_pages() when THP are disabled.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/huge_mm.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 5aca3d1bdb32..a155a7929b34 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -289,7 +289,11 @@ static inline struct list_head *page_deferred_list(struct page *page)
 #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
 #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
 
-#define hpage_nr_pages(x) 1
+static inline int hpage_nr_pages(struct page *page)
+{
+	VM_BUG_ON_PAGE(PageTail(page), page);
+	return 1;
+}
 
 static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
 {
-- 
2.25.1



  parent reply	other threads:[~2020-03-18 14:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 14:02 [PATCH v2 0/8] Misc MM patches Matthew Wilcox
2020-03-18 14:02 ` [PATCH v2 1/8] mm: Use vm_fault error code directly Matthew Wilcox
2020-03-18 14:02 ` [PATCH v2 2/8] mm: Rename arguments to find_subpage Matthew Wilcox
2020-03-19 10:15   ` Christoph Hellwig
2020-03-19 14:31   ` Kirill A. Shutemov
2020-03-19 15:59   ` Pankaj Gupta
2020-03-18 14:02 ` Matthew Wilcox [this message]
2020-03-19 10:18   ` [PATCH v2 3/8] mm: Check PageTail in hpage_nr_pages even when !THP Christoph Hellwig
2020-03-19 14:33   ` Kirill A. Shutemov
2020-03-18 14:02 ` [PATCH v2 4/8] mm: Optimise find_subpage for !THP Matthew Wilcox
2020-03-19 10:18   ` Christoph Hellwig
2020-03-18 14:02 ` [PATCH v2 5/8] mm: Remove CONFIG_TRANSPARENT_HUGE_PAGECACHE Matthew Wilcox
2020-03-19 14:35   ` Kirill A. Shutemov
2020-03-18 14:02 ` [PATCH v2 6/8] mm: Use VM_BUG_ON_PAGE in clear_page_dirty_for_io Matthew Wilcox
2020-03-18 14:02 ` [PATCH v2 7/8] mm: Unexport find_get_entry Matthew Wilcox
2020-03-18 14:02 ` [PATCH v2 8/8] mm: Rewrite pagecache_get_page documentation Matthew Wilcox
2020-03-19 10:19   ` Christoph Hellwig

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=20200318140253.6141-4-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-mm@kvack.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.