linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch 143/158] mm/madvise.c: replace with page_size() in madvise_inject_error()
@ 2019-12-01  1:57 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2019-12-01  1:57 UTC (permalink / raw)
  To: akpm, hushiyuan, jack, jgg, linfeilong, linux-mm, mhocko,
	minchan, mm-commits, peterz, rientjes, rppt, torvalds, yeyunfeng

From: Yunfeng Ye <yeyunfeng@huawei.com>
Subject: mm/madvise.c: replace with page_size() in madvise_inject_error()

page_size() is supported after the commit a50b854e073c ("mm: introduce
page_size()").

Use page_size() in madvise_inject_error() for readability.

[akpm@linux-foundation.org: use ulong for `size', per David]
Link: http://lkml.kernel.org/r/29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Hu Shiyuan <hushiyuan@huawei.com>
Cc: Feilong Lin <linfeilong@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/madvise.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/mm/madvise.c~mm-madvise-replace-with-page_size-in-madvise_inject_error
+++ a/mm/madvise.c
@@ -864,13 +864,13 @@ static int madvise_inject_error(int beha
 {
 	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;
 
@@ -882,9 +882,9 @@ static int madvise_inject_error(int beha
 		/*
 		 * 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);
_


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-01  1:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01  1:57 [patch 143/158] mm/madvise.c: replace with page_size() in madvise_inject_error() akpm

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