Skip to content

Commit

Permalink
mm/madvise.c: replace with page_size() in madvise_inject_error()
Browse files Browse the repository at this point in the history
page_size() is supported after the commit a50b854 ("mm: introduce
page_size()").

Use page_size() in madvise_inject_error() for readability.

[[email protected]: use ulong for `size', per David]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yunfeng Ye <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Hu Shiyuan <[email protected]>
Cc: Feilong Lin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
yeyunfeng-dev authored and torvalds committed Dec 1, 2019
1 parent 5d42ab2 commit d3cd257
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,13 +864,13 @@ static int madvise_inject_error(int behavior,
{
struct page *page;
struct zone *zone;
unsigned int order;
unsigned long size;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;


for (; start < end; start += PAGE_SIZE << order) {
for (; start < end; start += size) {
unsigned long pfn;
int ret;

Expand All @@ -882,9 +882,9 @@ static int madvise_inject_error(int behavior,
/*
* When soft offlining hugepages, after migrating the page
* we dissolve it, therefore in the second loop "page" will
* no longer be a compound page, and order will be 0.
* no longer be a compound page.
*/
order = compound_order(compound_head(page));
size = page_size(compound_head(page));

if (PageHWPoison(page)) {
put_page(page);
Expand Down

0 comments on commit d3cd257

Please sign in to comment.