Skip to contentSkip to conversation

mm-swap_slotsc-assignreset-cache-slot-by-value-directly.patch removed from -mm tree

merged [email protected] 1 participant 1 message Apr 3, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/swap_slots.c: assign|reset cache slot by value directly
has been removed from the -mm tree. Its filename was
mm-swap_slotsc-assignreset-cache-slot-by-value-directly.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Wei Yang <[email protected]>
Subject: mm/swap_slots.c: assign|reset cache slot by value directly

Currently we use a tmp pointer, pentry, to transfer and reset swap cache slot, which is a little redundant. Swap cache slot stores the entry value directly, assign and reset it by value would be straight forward.

Also this patch merges the else and if, since this is the only case we refill and repeat swap cache.

---

 mm/swap_slots.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
mm/swap_slots.c renamed from mm/swap_slots.c~mm-swap_slotsc-assignreset-cache-slot-by-value-directly +5 -7
@@ -309,7 +309,7 @@ direct_free:
 
 swp_entry_t get_swap_page(struct page *page)
 {
-	swp_entry_t entry, *pentry;
+	swp_entry_t entry;
 	struct swap_slots_cache *cache;
 
 	entry.val = 0;
@@ -336,13 +336,11 @@ swp_entry_t get_swap_page(struct page *p
 		if (cache->slots) {
 repeat:
 			if (cache->nr) {
-				pentry = &cache->slots[cache->cur++];
-				entry = *pentry;
-				pentry->val = 0;
+				entry = cache->slots[cache->cur];
+				cache->slots[cache->cur++].val = 0;
 				cache->nr--;
-			} else {
-				if (refill_swap_slots_cache(cache))
-					goto repeat;
+			} else if (refill_swap_slots_cache(cache)) {
+				goto repeat;
 			}
 		}
 		mutex_unlock(&cache->alloc_lock);

_

Patches currently in -mm which might be from [email protected] are