linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yunfeng Ye <yeyunfeng@huawei.com>
To: <akpm@linux-foundation.org>, <jgg@ziepe.ca>, <mhocko@suse.com>,
	<jglisse@redhat.com>, <minchan@kernel.org>,
	<peterz@infradead.org>, <jack@suse.cz>, <rppt@linux.ibm.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	"hushiyuan@huawei.com" <hushiyuan@huawei.com>,
	"linfeilong@huawei.com" <linfeilong@huawei.com>
Subject: [PATCH] mm/madvise: replace with page_size() in madvise_inject_error()
Date: Wed, 6 Nov 2019 15:06:27 +0800	[thread overview]
Message-ID: <29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com> (raw)

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

Replace with page_size() in madvise_inject_error() for readability.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
 mm/madvise.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index 2be9f3fdb05e..38c4e7fcf850 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -856,13 +856,13 @@ static int madvise_inject_error(int behavior,
 {
 	struct page *page;
 	struct zone *zone;
-	unsigned int order;
+	unsigned int 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;

@@ -874,9 +874,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);
-- 
2.7.4



             reply	other threads:[~2019-11-06  7:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06  7:06 Yunfeng Ye [this message]
2019-11-06 21:28 ` [PATCH] mm/madvise: replace with page_size() in madvise_inject_error() David Rientjes
2019-11-07  2:05   ` Yunfeng Ye
2019-11-07 20:48     ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29dce60c-38d6-0220-f292-e298f0c78c4d@huawei.com \
    --to=yeyunfeng@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=hushiyuan@huawei.com \
    --cc=jack@suse.cz \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rppt@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).