hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/kernel/time/jiffies.c
....@@ -1,25 +1,9 @@
1
-/***********************************************************************
2
-* linux/kernel/time/jiffies.c
3
-*
4
-* This file contains the jiffies based clocksource.
5
-*
6
-* Copyright (C) 2004, 2005 IBM, John Stultz (johnstul@us.ibm.com)
7
-*
8
-* This program is free software; you can redistribute it and/or modify
9
-* it under the terms of the GNU General Public License as published by
10
-* the Free Software Foundation; either version 2 of the License, or
11
-* (at your option) any later version.
12
-*
13
-* This program is distributed in the hope that it will be useful,
14
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
-* GNU General Public License for more details.
17
-*
18
-* You should have received a copy of the GNU General Public License
19
-* along with this program; if not, write to the Free Software
20
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
-*
22
-************************************************************************/
1
+// SPDX-License-Identifier: GPL-2.0+
2
+/*
3
+ * This file contains the jiffies based clocksource.
4
+ *
5
+ * Copyright (C) 2004, 2005 IBM, John Stultz (johnstul@us.ibm.com)
6
+ */
237 #include <linux/clocksource.h>
248 #include <linux/jiffies.h>
259 #include <linux/module.h>
....@@ -74,18 +58,19 @@
7458 .max_cycles = 10,
7559 };
7660
77
-__cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock);
61
+__cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(jiffies_lock);
62
+__cacheline_aligned_in_smp seqcount_t jiffies_seq;
7863
7964 #if (BITS_PER_LONG < 64)
8065 u64 get_jiffies_64(void)
8166 {
82
- unsigned long seq;
67
+ unsigned int seq;
8368 u64 ret;
8469
8570 do {
86
- seq = read_seqbegin(&jiffies_lock);
71
+ seq = read_seqcount_begin(&jiffies_seq);
8772 ret = jiffies_64;
88
- } while (read_seqretry(&jiffies_lock, seq));
73
+ } while (read_seqcount_retry(&jiffies_seq, seq));
8974 return ret;
9075 }
9176 EXPORT_SYMBOL(get_jiffies_64);
....@@ -105,7 +90,7 @@
10590 return &clocksource_jiffies;
10691 }
10792
108
-struct clocksource refined_jiffies;
93
+static struct clocksource refined_jiffies;
10994
11095 int register_refined_jiffies(long cycles_per_second)
11196 {