lkml.org 
[lkml]   [2022]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 10/15] mm/swap: break the loop if matching device is found
Date
We can break the loop if matching device is found to save some possible
cpu cycles because there should be only one matching device and there is
no need to continue if the matching one is already found.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/swapfile.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 133e03fea104..c90298a0561a 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1692,6 +1692,8 @@ int swap_type_of(dev_t device, sector_t offset)
spin_unlock(&swap_lock);
return type;
}
+
+ break;
}
}
spin_unlock(&swap_lock);
--
2.23.0
\
 
 \ /
  Last update: 2022-05-09 15:16    [W:0.334 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site