aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-09-25 03:28:34 -0400
committerNeilBrown <neilb@suse.de>2014-10-13 22:08:28 -0400
commit50bd3774058137e687b41da8b31fdd3544f7d901 (patch)
tree73e3c10f5721e20064e6d48115ed295f9f447e43 /drivers/md
parent0638bb0e732fa2c839fceec93fc02e2347e0f596 (diff)
md: avoid potential long delay under pers_lock
printk may cause long time lapse if value of printk_delay in sysctl is configured large by user. If register_md_personality takes long time to print in spinlock pers_lock, we may encounter high CPU usage rate when there are other pers_lock competitors who may be blocked to spin. We can avoid this condition by moving printk out of coverage of pers_lock spinlock. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d96aa8094736..d3a33a95e527 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7187,9 +7187,10 @@ static const struct file_operations md_seq_fops = {
7187 7187
7188int register_md_personality(struct md_personality *p) 7188int register_md_personality(struct md_personality *p)
7189{ 7189{
7190 printk(KERN_INFO "md: %s personality registered for level %d\n",
7191 p->name, p->level);
7190 spin_lock(&pers_lock); 7192 spin_lock(&pers_lock);
7191 list_add_tail(&p->list, &pers_list); 7193 list_add_tail(&p->list, &pers_list);
7192 printk(KERN_INFO "md: %s personality registered for level %d\n", p->name, p->level);
7193 spin_unlock(&pers_lock); 7194 spin_unlock(&pers_lock);
7194 return 0; 7195 return 0;
7195} 7196}