[PATCH] um: time-travel: avoid multiple identical propagations

Johannes Berg johannes at sipsolutions.net
Fri Dec 4 06:34:34 EST 2020


From: Johannes Berg <johannes.berg at intel.com>

If there is some kind of interrupt negotation or such then
it may happen that we send an update message multiple times,
avoid that in the interest of efficiency by storing the last
transmitted value and only sending a new update if it's not
the same as the last update.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 arch/um/kernel/time.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 5ac084deac7e..2c1c04f4ef27 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -198,7 +198,13 @@ static void time_travel_ext_update_request(unsigned long long time)
 
 void __time_travel_propagate_time(void)
 {
+	static unsigned long long last_propagated;
+
+	if (last_propagated == time_travel_time)
+		return;
+
 	time_travel_ext_req(UM_TIMETRAVEL_UPDATE, time_travel_time);
+	last_propagated = time_travel_time;
 }
 EXPORT_SYMBOL_GPL(__time_travel_propagate_time);
 
-- 
2.26.2




More information about the linux-um mailing list