Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timekeeping: Merge timekeeping_update_staged() and timekeeping_update()

timekeeping_update_staged() is the only call site of timekeeping_update().

Merge those functions. No functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20241009-devel-anna-maria-b4-timers-ptp-timekeeping-v2-25-554456a44a15@linutronix.de

authored by

Anna-Maria Behnsen and committed by
Thomas Gleixner
147ba943 0026766d

+14 -17
+14 -17
kernel/time/timekeeping.c
··· 548 548 * timekeeping_inject_sleeptime64() 549 549 * __timekeeping_inject_sleeptime(tk, delta); 550 550 * timestamp(); 551 - * timekeeping_update(tkd, tk, TK_CLEAR_NTP...); 551 + * timekeeping_update_staged(tkd, TK_CLEAR_NTP...); 552 552 * 553 553 * (2) On 32-bit systems, the 64-bit boot offset (tk->offs_boot) may be 554 554 * partially updated. Since the tk->offs_boot update is a rare event, this ··· 794 794 memcpy(&tkd->shadow_timekeeper, &tkd->timekeeper, sizeof(tkd->timekeeper)); 795 795 } 796 796 797 - static void timekeeping_update(struct tk_data *tkd, struct timekeeper *tk, unsigned int action) 797 + static void timekeeping_update_from_shadow(struct tk_data *tkd, unsigned int action) 798 798 { 799 + struct timekeeper *tk = &tk_core.shadow_timekeeper; 800 + 799 801 lockdep_assert_held(&tkd->lock); 802 + 803 + /* 804 + * Block out readers before running the updates below because that 805 + * updates VDSO and other time related infrastructure. Not blocking 806 + * the readers might let a reader see time going backwards when 807 + * reading from the VDSO after the VDSO update and then reading in 808 + * the kernel from the timekeeper before that got updated. 809 + */ 810 + write_seqcount_begin(&tkd->seq); 800 811 801 812 if (action & TK_CLEAR_NTP) { 802 813 tk->ntp_error = 0; ··· 826 815 827 816 if (action & TK_CLOCK_WAS_SET) 828 817 tk->clock_was_set_seq++; 829 - } 830 - 831 - static void timekeeping_update_from_shadow(struct tk_data *tkd, unsigned int action) 832 - { 833 - /* 834 - * Block out readers before invoking timekeeping_update() because 835 - * that updates VDSO and other time related infrastructure. Not 836 - * blocking the readers might let a reader see time going backwards 837 - * when reading from the VDSO after the VDSO update and then 838 - * reading in the kernel from the timekeeper before that got updated. 839 - */ 840 - write_seqcount_begin(&tkd->seq); 841 - 842 - timekeeping_update(tkd, &tkd->shadow_timekeeper, action); 843 818 844 819 /* 845 820 * Update the real timekeeper. ··· 835 838 * the cacheline optimized data layout of the timekeeper and requires 836 839 * another indirection. 837 840 */ 838 - memcpy(&tkd->timekeeper, &tkd->shadow_timekeeper, sizeof(tkd->shadow_timekeeper)); 841 + memcpy(&tkd->timekeeper, tk, sizeof(*tk)); 839 842 write_seqcount_end(&tkd->seq); 840 843 } 841 844