mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Cc: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Subject: [PATCH 04/26] sched: Convert thread_group_cputimer lock to raw_spinlock
Date: Mon, 11 Jan 2010 22:26:34 +0100	[thread overview]
Message-ID: <1263245216-14754-5-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1263245216-14754-4-git-send-email-jkacur@redhat.com>

Convert locks which cannot sleep in preempt-rt to raw_spinlocks.

See also a3f22fd7ae186a29b413ad959184f9b4c1d32173

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 include/linux/init_task.h |    2 +-
 include/linux/sched.h     |    4 ++--
 kernel/posix-cpu-timers.c |    8 ++++----
 kernel/sched_stats.h      |   12 ++++++------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index abec69b..e93b8cd 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -27,7 +27,7 @@ extern struct fs_struct init_fs;
 	.cputimer	= { 						\
 		.cputime = INIT_CPUTIME,				\
 		.running = 0,						\
-		.lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
+		.lock = __RAW_SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
 	},								\
 }
 
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8d4991b..ed5029e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -552,7 +552,7 @@ struct task_cputime {
 struct thread_group_cputimer {
 	struct task_cputime cputime;
 	int running;
-	spinlock_t lock;
+	raw_spinlock_t lock;
 };
 
 /*
@@ -2447,7 +2447,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times);
 static inline void thread_group_cputime_init(struct signal_struct *sig)
 {
 	sig->cputimer.cputime = INIT_CPUTIME;
-	spin_lock_init(&sig->cputimer.lock);
+	raw_spin_lock_init(&sig->cputimer.lock);
 	sig->cputimer.running = 0;
 }
 
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 438ff45..359cc24 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -280,7 +280,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
 	struct task_cputime sum;
 	unsigned long flags;
 
-	spin_lock_irqsave(&cputimer->lock, flags);
+	raw_spin_lock_irqsave(&cputimer->lock, flags);
 	if (!cputimer->running) {
 		cputimer->running = 1;
 		/*
@@ -293,7 +293,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
 		update_gt_cputime(&cputimer->cputime, &sum);
 	}
 	*times = cputimer->cputime;
-	spin_unlock_irqrestore(&cputimer->lock, flags);
+	raw_spin_unlock_irqrestore(&cputimer->lock, flags);
 }
 
 /*
@@ -1068,9 +1068,9 @@ static void stop_process_timers(struct task_struct *tsk)
 	if (!cputimer->running)
 		return;
 
-	spin_lock_irqsave(&cputimer->lock, flags);
+	raw_spin_lock_irqsave(&cputimer->lock, flags);
 	cputimer->running = 0;
-	spin_unlock_irqrestore(&cputimer->lock, flags);
+	raw_spin_unlock_irqrestore(&cputimer->lock, flags);
 }
 
 static u32 onecputick;
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 32d2bd4..9ecca2f 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -306,10 +306,10 @@ static inline void account_group_user_time(struct task_struct *tsk,
 	if (!cputimer->running)
 		return;
 
-	spin_lock(&cputimer->lock);
+	raw_spin_lock(&cputimer->lock);
 	cputimer->cputime.utime =
 		cputime_add(cputimer->cputime.utime, cputime);
-	spin_unlock(&cputimer->lock);
+	raw_spin_unlock(&cputimer->lock);
 }
 
 /**
@@ -336,10 +336,10 @@ static inline void account_group_system_time(struct task_struct *tsk,
 	if (!cputimer->running)
 		return;
 
-	spin_lock(&cputimer->lock);
+	raw_spin_lock(&cputimer->lock);
 	cputimer->cputime.stime =
 		cputime_add(cputimer->cputime.stime, cputime);
-	spin_unlock(&cputimer->lock);
+	raw_spin_unlock(&cputimer->lock);
 }
 
 /**
@@ -369,7 +369,7 @@ static inline void account_group_exec_runtime(struct task_struct *tsk,
 	if (!cputimer->running)
 		return;
 
-	spin_lock(&cputimer->lock);
+	raw_spin_lock(&cputimer->lock);
 	cputimer->cputime.sum_exec_runtime += ns;
-	spin_unlock(&cputimer->lock);
+	raw_spin_unlock(&cputimer->lock);
 }
-- 
1.6.5.2


  reply	other threads:[~2010-01-11 21:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11 21:26 [PATCH 00/26] Convert locks that can't sleep in -rt " John Kacur
2010-01-11 21:26 ` [PATCH 01/26] xtime_lock: Convert atomic_seqlock to raw_seqlock, fix up all users John Kacur
2010-01-11 21:26   ` [PATCH 02/26] seqlock: Create raw_seqlock John Kacur
2010-01-11 21:26     ` [PATCH 03/26] x86: Convert tlbstate_lock to raw_spinlock John Kacur
2010-01-11 21:26       ` John Kacur [this message]
2010-01-11 21:26         ` [PATCH 05/26] x86: Convert ioapic_lock and vector_lock to raw_spinlocks John Kacur
2010-01-11 21:26           ` [PATCH 06/26] x86: Convert i8259A_lock to raw_spinlock John Kacur
2010-01-11 21:26             ` [PATCH 07/26] x86: Convert pci_config_lock " John Kacur
2010-01-11 21:26               ` [PATCH 08/26] i8253: Convert i8253_lock " John Kacur
2010-01-11 21:26                 ` [PATCH 09/26] x86: Convert set_atomicity_lock " John Kacur
2010-01-11 21:26                   ` [PATCH 10/26] ACPI: Convert c3_lock " John Kacur
2010-01-11 21:26                     ` [PATCH 11/26] rtmutex: Convert wait_lock and pi_lock " John Kacur
2010-01-11 21:26                       ` [PATCH 12/26] printk: Convert lock " John Kacur
2010-01-11 21:26                         ` [PATCH 13/26] genirq: Convert locks to raw_spinlocks John Kacur
2010-01-11 21:26                           ` [PATCH 14/26] trace: Convert various locks to raw_spinlock John Kacur
2010-01-11 21:26                             ` [PATCH 15/26] clocksource: Convert watchdog_lock " John Kacur
2010-01-11 21:26                               ` [PATCH 16/26] timer_stats: Convert to raw_spinlocks John Kacur
2010-01-11 21:26                                 ` [PATCH 17/26] x86: kvm: Convert i8254/i8259 locks to raw_spinlock John Kacur
2010-01-11 21:26                                   ` [PATCH 18/26] x86 - nmi: Convert nmi_lock " John Kacur
2010-01-11 21:26                                     ` [PATCH 19/26] cgroups: Convert cgroups release_list_lock " John Kacur
2010-01-11 21:26                                       ` [PATCH 20/26] proportions: Convert spinlocks to raw_spinlocks John Kacur
2010-01-11 21:26                                         ` [PATCH 21/26] percpu_counter: Convert to raw_spinlock John Kacur
2010-01-11 21:26                                           ` [PATCH 22/26] oprofile: " John Kacur
2010-01-11 21:26                                             ` [PATCH 23/26] vgacon: Convert vga console lock " John Kacur
2010-01-11 21:26                                               ` [PATCH 24/26] pci-access: Convert pci_lock " John Kacur
2010-01-11 21:26                                                 ` [PATCH 25/26] kprobes: Convert to raw_spinlocks John Kacur
2010-01-11 21:26                                                   ` [PATCH 26/26] softlockup: " John Kacur
2010-01-12  3:54                                                   ` [PATCH 25/26] kprobes: " Frederic Weisbecker
2010-01-11 21:50                                       ` [PATCH 19/26] cgroups: Convert cgroups release_list_lock to raw_spinlock Paul Menage
2010-01-11 22:11                                         ` John Kacur
2010-01-12  3:39                             ` [PATCH 14/26] trace: Convert various locks " Frederic Weisbecker
2010-01-13 15:28                               ` Steven Rostedt
2010-01-13 15:36                                 ` John Kacur
2010-01-13 15:41                                   ` Steven Rostedt
2010-01-13 18:09                                     ` John Kacur
2010-01-17 13:00                                       ` Frederic Weisbecker
2010-01-12  3:24 ` [PATCH 00/26] Convert locks that can't sleep in -rt " Frederic Weisbecker
2010-01-12  3:49   ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263245216-14754-5-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome