From: Balbir Singh <bsingharora@gmail.com>
To: akpm@linux-foundation.org
Cc: mhocko@suse.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Balbir Singh <bsingharora@gmail.com>
Subject: [PATCH] mm/hotplug: Optimize clear_hwpoisoned_pages
Date: Fri, 2 Nov 2018 23:00:01 +1100 [thread overview]
Message-ID: <20181102120001.4526-1-bsingharora@gmail.com> (raw)
In hot remove, we try to clear poisoned pages, but
a small optimization to check if num_poisoned_pages
is 0 helps remove the iteration through nr_pages.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
mm/sparse.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/sparse.c b/mm/sparse.c
index 33307fc05c4d..16219c7ddb5f 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -724,6 +724,16 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
if (!memmap)
return;
+ /*
+ * A further optimization is to have per section
+ * ref counted num_poisoned_pages, but that is going
+ * to need more space per memmap, for now just do
+ * a quick global check, this should speed up this
+ * routine in the absence of bad pages.
+ */
+ if (atomic_long_read(&num_poisoned_pages) == 0)
+ return;
+
for (i = 0; i < nr_pages; i++) {
if (PageHWPoison(&memmap[i])) {
atomic_long_sub(1, &num_poisoned_pages);
--
2.17.1
next reply other threads:[~2018-11-02 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-02 12:00 Balbir Singh [this message]
2018-11-02 12:32 ` Michal Hocko
2018-11-06 23:32 ` Naoya Horiguchi
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=20181102120001.4526-1-bsingharora@gmail.com \
--to=bsingharora@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.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