lkml.org 
[lkml]   [2020]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: rectify a page bad reason
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
>
>

\
 
 \ /
  Last update: 2020-12-29 13:15    [W:0.021 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site