Re: [PATCH -mm -v11 1/5] mm, THP, swap: Delay splitting THP during swap out

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Huang, Ying" <ying.huang@xxxxxxxxx> writes:

> From: Huang Ying <ying.huang@xxxxxxxxx>
>
> In this patch, splitting huge page is delayed from almost the first
> step of swapping out to after allocating the swap space for the
> THP (Transparent Huge Page) and adding the THP into the swap cache.
> This will batch the corresponding operation, thus improve THP swap out
> throughput.
>
> This is the first step for the THP swap optimization.  The plan is to
> delay splitting the THP step by step and avoid splitting the THP
> finally.
>

I found two issues in this patch, could you fold the following fix patch
into the original patch?

Best Regards,
Huang, Ying

------------------------------------------------------------->
From: Huang Ying <ying.huang@xxxxxxxxx>
Subject: [PATCH] mm, THP, swap: Fix two issues in THP optimize patch

When changing the logic for cluster allocation for THP in
get_swap_page(), I made a mistake so that a normal swap slot may be
allocated for a THP instead of return with failure.  This is fixed in
the patch.

And I found two likely/unlikely annotation is wrong in
get_swap_pages(), because that is slow path, I just removed the
likely/unlikely annotation.

Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
---
 mm/swap_slots.c | 5 +++--
 mm/swapfile.c   | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/swap_slots.c b/mm/swap_slots.c
index 78047d1efedd..90c1032a8ac3 100644
--- a/mm/swap_slots.c
+++ b/mm/swap_slots.c
@@ -309,8 +309,9 @@ swp_entry_t get_swap_page(struct page *page)
 
 	entry.val = 0;
 
-	if (IS_ENABLED(CONFIG_THP_SWAP) && PageTransHuge(page)) {
-		get_swap_pages(1, true, &entry);
+	if (PageTransHuge(page)) {
+		if (IS_ENABLED(CONFIG_THP_SWAP))
+			get_swap_pages(1, true, &entry);
 		return entry;
 	}
 
diff --git a/mm/swapfile.c b/mm/swapfile.c
index f4c0f2a92bf0..984f0dd94948 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -937,13 +937,13 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[])
 			spin_unlock(&si->lock);
 			goto nextsi;
 		}
-		if (likely(cluster))
+		if (cluster)
 			n_ret = swap_alloc_cluster(si, swp_entries);
 		else
 			n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE,
 						    n_goal, swp_entries);
 		spin_unlock(&si->lock);
-		if (n_ret || unlikely(cluster))
+		if (n_ret || cluster)
 			goto check_out;
 		pr_debug("scan_swap_map of si %d failed to find offset\n",
 			si->type);
-- 
2.11.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux