linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page-flags: Check enforce parameter in PF_ONLY_HEAD()
@ 2019-03-27 12:27 Anshuman Khandual
  2019-03-27 13:15 ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Anshuman Khandual @ 2019-03-27 12:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, hannes, david, vbabka, mhocko, willy, akpm

Just check for enforce parameter in PF_ONLY_HEAD() wrapper before calling
VM_BUG_ON_PGFLAGS() for tail pages.

Fixes: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit")
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/linux/page-flags.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9f8712a4b1a5..82539e287bc6 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -229,7 +229,7 @@ static inline void page_init_poison(struct page *page, size_t size)
 #define PF_ANY(page, enforce)	PF_POISONED_CHECK(page)
 #define PF_HEAD(page, enforce)	PF_POISONED_CHECK(compound_head(page))
 #define PF_ONLY_HEAD(page, enforce) ({					\
-		VM_BUG_ON_PGFLAGS(PageTail(page), page);		\
+		VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page);	\
 		PF_POISONED_CHECK(page); })
 #define PF_NO_TAIL(page, enforce) ({					\
 		VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page);	\
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/page-flags: Check enforce parameter in PF_ONLY_HEAD()
  2019-03-27 12:27 [PATCH] mm/page-flags: Check enforce parameter in PF_ONLY_HEAD() Anshuman Khandual
@ 2019-03-27 13:15 ` Michal Hocko
  2019-03-27 13:59   ` Anshuman Khandual
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2019-03-27 13:15 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-kernel, linux-mm, hannes, david, vbabka, willy, akpm,
	Nicholas Piggin

[Cc Nick]

On Wed 27-03-19 17:57:52, Anshuman Khandual wrote:
> Just check for enforce parameter in PF_ONLY_HEAD() wrapper before calling
> VM_BUG_ON_PGFLAGS() for tail pages.

Why is this an actual fix? Only TESTPAGEFLAG doesn't enforce the check
but I suspect that Nick just wanted the check to be _always_ performed
as the name suggests. What kind of problem are you trying to solve?

> Fixes: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit")
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  include/linux/page-flags.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 9f8712a4b1a5..82539e287bc6 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -229,7 +229,7 @@ static inline void page_init_poison(struct page *page, size_t size)
>  #define PF_ANY(page, enforce)	PF_POISONED_CHECK(page)
>  #define PF_HEAD(page, enforce)	PF_POISONED_CHECK(compound_head(page))
>  #define PF_ONLY_HEAD(page, enforce) ({					\
> -		VM_BUG_ON_PGFLAGS(PageTail(page), page);		\
> +		VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page);	\
>  		PF_POISONED_CHECK(page); })
>  #define PF_NO_TAIL(page, enforce) ({					\
>  		VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page);	\
> -- 
> 2.20.1
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/page-flags: Check enforce parameter in PF_ONLY_HEAD()
  2019-03-27 13:15 ` Michal Hocko
@ 2019-03-27 13:59   ` Anshuman Khandual
  0 siblings, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2019-03-27 13:59 UTC (permalink / raw)
  To: Michal Hocko
  Cc: linux-kernel, linux-mm, hannes, david, vbabka, willy, akpm,
	Nicholas Piggin



On 03/27/2019 06:45 PM, Michal Hocko wrote:
> [Cc Nick]
> 
> On Wed 27-03-19 17:57:52, Anshuman Khandual wrote:
>> Just check for enforce parameter in PF_ONLY_HEAD() wrapper before calling
>> VM_BUG_ON_PGFLAGS() for tail pages.
> Why is this an actual fix? Only TESTPAGEFLAG doesn't enforce the check
> but I suspect that Nick just wanted the check to be _always_ performed
> as the name suggests. What kind of problem are you trying to solve?

Did not hit any problem directly. Just from code inspection it seemed that
the enforce check was missing as compared to other wrappers there. I felt
that the commit could have probably omitted the check by mistake.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-27 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 12:27 [PATCH] mm/page-flags: Check enforce parameter in PF_ONLY_HEAD() Anshuman Khandual
2019-03-27 13:15 ` Michal Hocko
2019-03-27 13:59   ` Anshuman Khandual

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).