* [PATCH] mm: rectify a page bad reason
@ 2020-12-29 3:11 Rongwei Wang
[not found] ` <CAPSr9jFf4HoODzubWx-JkVKK69YGx0vgaesuVU8od-qyyGOjpw@mail.gmail.com>
2020-12-29 12:13 ` Matthew Wilcox
0 siblings, 2 replies; 3+ messages in thread
From: Rongwei Wang @ 2020-12-29 3:11 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, rongwei.wang
Hi
When I was doing some memory-related projects, it always reported error
"nonzero mapcount", but its judgment condition was that _mapcount was not equal
to -1, so I felt the original string was a bit inappropriate, so I tried to
update it.
Signed-off-by: Rongwei Wang <rongwei.wang@linux.alibaba.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7a2c89b..57d7f26 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1114,7 +1114,7 @@ static const char *page_bad_reason(struct page *page, unsigned long flags)
const char *bad_reason = NULL;
if (unlikely(atomic_read(&page->_mapcount) != -1))
- bad_reason = "nonzero mapcount";
+ bad_reason = "non-(-1) _mapcount";
if (unlikely(page->mapping != NULL))
bad_reason = "non-NULL mapping";
if (unlikely(page_ref_count(page) != 0))
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: rectify a page bad reason
[not found] ` <CAPSr9jFf4HoODzubWx-JkVKK69YGx0vgaesuVU8od-qyyGOjpw@mail.gmail.com>
@ 2020-12-29 7:22 ` Rongwei Wang
0 siblings, 0 replies; 3+ messages in thread
From: Rongwei Wang @ 2020-12-29 7:22 UTC (permalink / raw)
To: Muchun Song; +Cc: akpm, linux-mm
> On Dec 29, 2020, at 11:21 AM, Muchun Song <smuchun@gmail.com> wrote:
>
> Rongwei Wang <rongwei.wang@linux.alibaba.com> 于2020年12月29日周二 上午11:16写道:
>>
>> Hi
>>
>> When I was doing some memory-related projects, it always reported error
>> "nonzero mapcount", but its judgment condition was that _mapcount was not equal
>> to -1, so I felt the original string was a bit inappropriate, so I tried to
>> update it.
>
> Hi Rongwei,
>
> Because the page_mapcount() just returns atomic_read(&page->_mapcount) + 1,
> reporting "nonzero mapcount" is reasonable when _mapcount is -1.
Hi, Muchun
Thank you for the tip. I read the __dump_page function again.
Indeed here need to combine page_mapcount+page_bad_reason to understand, and reporting "nonzero mapcount" is reasonable. It always feel a little strange ONLY look at page_bad_reason.
Maybe it should be changed (or NOT) to this:
if (unlikely(page_mapcount(page) != 0))
bad_reason = "nonzero mapcount”;
Anyway, thanks
Rongwei Wang
>
> Thanks.
>
>>
>> Signed-off-by: Rongwei Wang <rongwei.wang@linux.alibaba.com>
>> ---
>> mm/page_alloc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 7a2c89b..57d7f26 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -1114,7 +1114,7 @@ static const char *page_bad_reason(struct page *page, unsigned long flags)
>> const char *bad_reason = NULL;
>>
>> if (unlikely(atomic_read(&page->_mapcount) != -1))
>> - bad_reason = "nonzero mapcount";
>> + bad_reason = "non-(-1) _mapcount";
>> if (unlikely(page->mapping != NULL))
>> bad_reason = "non-NULL mapping";
>> if (unlikely(page_ref_count(page) != 0))
>> --
>> 1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: rectify a page bad reason
2020-12-29 3:11 [PATCH] mm: rectify a page bad reason Rongwei Wang
[not found] ` <CAPSr9jFf4HoODzubWx-JkVKK69YGx0vgaesuVU8od-qyyGOjpw@mail.gmail.com>
@ 2020-12-29 12:13 ` Matthew Wilcox
1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2020-12-29 12:13 UTC (permalink / raw)
To: Rongwei Wang; +Cc: akpm, linux-mm, linux-kernel
On Tue, Dec 29, 2020 at 11:11:56AM +0800, Rongwei Wang wrote:
> When I was doing some memory-related projects, it always reported error
> "nonzero mapcount", but its judgment condition was that _mapcount was not equal
> to -1, so I felt the original string was a bit inappropriate, so I tried to
> update it.
But '_mapcount' of -1 _is_ a mapcount of 0. If we need to improve the
documentation somewhere, that'd be better than changing this message.
I do wonder if we want to add:
if (unlikely(page_has_type(page))
bad_reason = "page still typed";
It's covered by the non-zero mapcount case, but is slightly misleading.
> if (unlikely(atomic_read(&page->_mapcount) != -1))
> - bad_reason = "nonzero mapcount";
> + bad_reason = "non-(-1) _mapcount";
> if (unlikely(page->mapping != NULL))
> bad_reason = "non-NULL mapping";
> if (unlikely(page_ref_count(page) != 0))
> --
> 1.8.3.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-29 12:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 3:11 [PATCH] mm: rectify a page bad reason Rongwei Wang
[not found] ` <CAPSr9jFf4HoODzubWx-JkVKK69YGx0vgaesuVU8od-qyyGOjpw@mail.gmail.com>
2020-12-29 7:22 ` Rongwei Wang
2020-12-29 12:13 ` Matthew Wilcox
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.