[PATCH] documentation: Make sample code and documentation consistent
In the chapter 'analogy with reader-writer locking', the sample code uses spinlock_t in reader-writer case. Just correct it so that we can read the document easily. Signed-off-by: Yao Dongdong <yaodongd...@huawei.com> --- Documentation/RCU/whatisRCU.txt | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index dc49c67..e33304e 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt @@ -681,22 +681,30 @@ Although RCU can be used in many different ways, a very common use of RCU is analogous to reader-writer locking. The following unified diff shows how closely related RCU and reader-writer locking can be. + @@ -5,5 +5,5 @@ struct el { + int data; + /* Other data fields */ + }; + -rwlock_t listmutex; + +spinlock_t listmutex; + struct el head; + @@ -13,15 +14,15 @@ struct list_head *lp; struct el *p; - - read_lock(); + - read_lock(); - list_for_each_entry(p, head, lp) { + rcu_read_lock(); + list_for_each_entry_rcu(p, head, lp) { if (p->key == key) { *result = p->data; - - read_unlock(); + - read_unlock(); + rcu_read_unlock(); return 1; } } - - read_unlock(); + - read_unlock(); + rcu_read_unlock(); return 0; } @@ -732,7 +740,7 @@ Or, for those who prefer a side-by-side listing: 5 int data; 5 int data; 6 /* Other data fields */6 /* Other data fields */ 7 }; 7 }; - 8 spinlock_t listmutex;8 spinlock_t listmutex; + 8 rwlock_t listmutex; 8 spinlock_t listmutex; 9 struct el head; 9 struct el head; 1 int search(long key, int *result)1 int search(long key, int *result) @@ -740,15 +748,15 @@ Or, for those who prefer a side-by-side listing: 3 struct list_head *lp; 3 struct list_head *lp; 4 struct el *p; 4 struct el *p; 5 5 - 6 read_lock(); 6 rcu_read_lock(); + 6 read_lock(); 6 rcu_read_lock(); 7 list_for_each_entry(p, head, lp) { 7 list_for_each_entry_rcu(p, head, lp) { 8 if (p->key == key) { 8 if (p->key == key) { 9 *result = p->data; 9 *result = p->data; -10 read_unlock();10 rcu_read_unlock(); +10 read_unlock(); 10 rcu_read_unlock(); 11 return 1; 11 return 1; 12 } 12 } 13 } 13 } -14 read_unlock();14 rcu_read_unlock(); +14 read_unlock(); 14 rcu_read_unlock(); 15 return 0; 15 return 0; 16 } 16 } -- 1.7.9.5
[PATCH] documentation: Make sample code and documentation consistent
In the chapter 'analogy with reader-writer locking', the sample code uses spinlock_t in reader-writer case. Just correct it so that we can read the document easily. Signed-off-by: Yao Dongdong --- Documentation/RCU/whatisRCU.txt | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index dc49c67..e33304e 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt @@ -681,22 +681,30 @@ Although RCU can be used in many different ways, a very common use of RCU is analogous to reader-writer locking. The following unified diff shows how closely related RCU and reader-writer locking can be. + @@ -5,5 +5,5 @@ struct el { + int data; + /* Other data fields */ + }; + -rwlock_t listmutex; + +spinlock_t listmutex; + struct el head; + @@ -13,15 +14,15 @@ struct list_head *lp; struct el *p; - - read_lock(); + - read_lock(); - list_for_each_entry(p, head, lp) { + rcu_read_lock(); + list_for_each_entry_rcu(p, head, lp) { if (p->key == key) { *result = p->data; - - read_unlock(); + - read_unlock(); + rcu_read_unlock(); return 1; } } - - read_unlock(); + - read_unlock(); + rcu_read_unlock(); return 0; } @@ -732,7 +740,7 @@ Or, for those who prefer a side-by-side listing: 5 int data; 5 int data; 6 /* Other data fields */6 /* Other data fields */ 7 }; 7 }; - 8 spinlock_t listmutex;8 spinlock_t listmutex; + 8 rwlock_t listmutex; 8 spinlock_t listmutex; 9 struct el head; 9 struct el head; 1 int search(long key, int *result)1 int search(long key, int *result) @@ -740,15 +748,15 @@ Or, for those who prefer a side-by-side listing: 3 struct list_head *lp; 3 struct list_head *lp; 4 struct el *p; 4 struct el *p; 5 5 - 6 read_lock(); 6 rcu_read_lock(); + 6 read_lock(); 6 rcu_read_lock(); 7 list_for_each_entry(p, head, lp) { 7 list_for_each_entry_rcu(p, head, lp) { 8 if (p->key == key) { 8 if (p->key == key) { 9 *result = p->data; 9 *result = p->data; -10 read_unlock();10 rcu_read_unlock(); +10 read_unlock(); 10 rcu_read_unlock(); 11 return 1; 11 return 1; 12 } 12 } 13 } 13 } -14 read_unlock();14 rcu_read_unlock(); +14 read_unlock(); 14 rcu_read_unlock(); 15 return 0; 15 return 0; 16 } 16 } -- 1.7.9.5
[PATCH] rcu: Remove reduplicate check of cpu_online
The calling function invoke_rcu_core will check it. Signed-off-by: Yao Dongdong --- kernel/rcu/tree.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 48d640c..e5f9b7e 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2741,7 +2741,7 @@ static void __call_rcu_core(struct rcu_state *rsp, struct rcu_data *rdp, * If called from an extended quiescent state, invoke the RCU * core in order to force a re-evaluation of RCU's idleness. */ - if (!rcu_is_watching() && cpu_online(smp_processor_id())) + if (!rcu_is_watching()) invoke_rcu_core(); /* If interrupts were disabled or CPU offline, don't invoke RCU core. */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] rcu: Remove reduplicate check of cpu_online
The calling function invoke_rcu_core will check it. Signed-off-by: Yao Dongdong yaodongd...@huawei.com --- kernel/rcu/tree.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 48d640c..e5f9b7e 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2741,7 +2741,7 @@ static void __call_rcu_core(struct rcu_state *rsp, struct rcu_data *rdp, * If called from an extended quiescent state, invoke the RCU * core in order to force a re-evaluation of RCU's idleness. */ - if (!rcu_is_watching() cpu_online(smp_processor_id())) + if (!rcu_is_watching()) invoke_rcu_core(); /* If interrupts were disabled or CPU offline, don't invoke RCU core. */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:sched/core] sched/core: Remove check of p->sched_class
Commit-ID: 1b537c7d1e58c761212a193085f9049b58f672e6 Gitweb: http://git.kernel.org/tip/1b537c7d1e58c761212a193085f9049b58f672e6 Author: Yao Dongdong AuthorDate: Mon, 29 Dec 2014 14:41:43 +0800 Committer: Ingo Molnar CommitDate: Wed, 14 Jan 2015 13:34:17 +0100 sched/core: Remove check of p->sched_class Search all usage of p->sched_class in sched/core.c, no one check it before use, so it seems that every task must belong to one sched_class. Signed-off-by: Yao Dongdong [ Moved the early class assignment to make it boot. ] Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Link: http://lkml.kernel.org/r/1419835303-28958-1-git-send-email-yaodongd...@huawei.com Signed-off-by: Ingo Molnar --- kernel/sched/core.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 95ac795..46a2345 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4744,7 +4744,7 @@ static struct rq *move_queued_task(struct task_struct *p, int new_cpu) void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) { - if (p->sched_class && p->sched_class->set_cpus_allowed) + if (p->sched_class->set_cpus_allowed) p->sched_class->set_cpus_allowed(p, new_mask); cpumask_copy(>cpus_allowed, new_mask); @@ -7254,6 +7254,11 @@ void __init sched_init(void) enter_lazy_tlb(_mm, current); /* +* During early bootup we pretend to be a normal task: +*/ + current->sched_class = _sched_class; + + /* * Make us the idle thread. Technically, schedule() should not be * called from this thread, however somewhere below it might be, * but because we are the idle thread, we just pick up running again @@ -7263,11 +7268,6 @@ void __init sched_init(void) calc_load_update = jiffies + LOAD_FREQ; - /* -* During early bootup we pretend to be a normal task: -*/ - current->sched_class = _sched_class; - #ifdef CONFIG_SMP zalloc_cpumask_var(_domains_tmpmask, GFP_NOWAIT); /* May be allocated at isolcpus cmdline parse time */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:sched/core] sched/core: Remove check of p-sched_class
Commit-ID: 1b537c7d1e58c761212a193085f9049b58f672e6 Gitweb: http://git.kernel.org/tip/1b537c7d1e58c761212a193085f9049b58f672e6 Author: Yao Dongdong yaodongd...@huawei.com AuthorDate: Mon, 29 Dec 2014 14:41:43 +0800 Committer: Ingo Molnar mi...@kernel.org CommitDate: Wed, 14 Jan 2015 13:34:17 +0100 sched/core: Remove check of p-sched_class Search all usage of p-sched_class in sched/core.c, no one check it before use, so it seems that every task must belong to one sched_class. Signed-off-by: Yao Dongdong yaodongd...@huawei.com [ Moved the early class assignment to make it boot. ] Signed-off-by: Peter Zijlstra (Intel) pet...@infradead.org Cc: Linus Torvalds torva...@linux-foundation.org Link: http://lkml.kernel.org/r/1419835303-28958-1-git-send-email-yaodongd...@huawei.com Signed-off-by: Ingo Molnar mi...@kernel.org --- kernel/sched/core.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 95ac795..46a2345 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4744,7 +4744,7 @@ static struct rq *move_queued_task(struct task_struct *p, int new_cpu) void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) { - if (p-sched_class p-sched_class-set_cpus_allowed) + if (p-sched_class-set_cpus_allowed) p-sched_class-set_cpus_allowed(p, new_mask); cpumask_copy(p-cpus_allowed, new_mask); @@ -7254,6 +7254,11 @@ void __init sched_init(void) enter_lazy_tlb(init_mm, current); /* +* During early bootup we pretend to be a normal task: +*/ + current-sched_class = fair_sched_class; + + /* * Make us the idle thread. Technically, schedule() should not be * called from this thread, however somewhere below it might be, * but because we are the idle thread, we just pick up running again @@ -7263,11 +7268,6 @@ void __init sched_init(void) calc_load_update = jiffies + LOAD_FREQ; - /* -* During early bootup we pretend to be a normal task: -*/ - current-sched_class = fair_sched_class; - #ifdef CONFIG_SMP zalloc_cpumask_var(sched_domains_tmpmask, GFP_NOWAIT); /* May be allocated at isolcpus cmdline parse time */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched/core: remove check of p->sched_class
Search all usage of p->sched_class in sched/core.c, no one check it before use, so it seems that every task must belong to one sched_class. Signed-off-by: Yao Dongdong --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b5797b7..bdab49b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4740,7 +4740,7 @@ static struct rq *move_queued_task(struct task_struct *p, int new_cpu) void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) { - if (p->sched_class && p->sched_class->set_cpus_allowed) + if (p->sched_class->set_cpus_allowed) p->sched_class->set_cpus_allowed(p, new_mask); cpumask_copy(>cpus_allowed, new_mask); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched/core: remove check of p-sched_class
Search all usage of p-sched_class in sched/core.c, no one check it before use, so it seems that every task must belong to one sched_class. Signed-off-by: Yao Dongdong yaodongd...@huawei.com --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b5797b7..bdab49b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4740,7 +4740,7 @@ static struct rq *move_queued_task(struct task_struct *p, int new_cpu) void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) { - if (p-sched_class p-sched_class-set_cpus_allowed) + if (p-sched_class-set_cpus_allowed) p-sched_class-set_cpus_allowed(p, new_mask); cpumask_copy(p-cpus_allowed, new_mask); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] selinux: Remove security_ops extern
security_ops is not used in this file. Signed-off-by: Yao Dongdong --- security/selinux/hooks.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index c603b20..6da7532 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -95,8 +95,6 @@ #include "audit.h" #include "avc_ss.h" -extern struct security_operations *security_ops; - /* SECMARK reference count */ static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0); -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] selinux: Remove security_ops extern
security_ops is not used in this file. Signed-off-by: Yao Dongdong yaodongd...@huawei.com --- security/selinux/hooks.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index c603b20..6da7532 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -95,8 +95,6 @@ #include audit.h #include avc_ss.h -extern struct security_operations *security_ops; - /* SECMARK reference count */ static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0); -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched, cleanup, dm bufio: Replace dm_bufio_cond_resched with might_resched
The judge of need_resched() before _cond_resched() in dm_bufio_cond_resched() is no need. Because _cond_resched() itself judges should_resched() which means need and can resched. In addition, might_resched() can do all these. Signed-off-by: Yao Dongdong --- drivers/md/dm-bufio.c | 35 +++ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index afe7971..3660a24 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -186,19 +186,6 @@ static void dm_bufio_unlock(struct dm_bufio_client *c) mutex_unlock(>lock); } -/* - * FIXME Move to sched.h? - */ -#ifdef CONFIG_PREEMPT_VOLUNTARY -# define dm_bufio_cond_resched() \ -do { \ - if (unlikely(need_resched())) \ - _cond_resched();\ -} while (0) -#else -# define dm_bufio_cond_resched()do { } while (0) -#endif - /**/ /* @@ -648,7 +635,7 @@ static void __flush_write_list(struct list_head *write_list) list_entry(write_list->next, struct dm_buffer, write_list); list_del(>write_list); submit_io(b, WRITE, b->block, write_endio); - dm_bufio_cond_resched(); + might_resched(); } blk_finish_plug(); } @@ -687,7 +674,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c) __unlink_buffer(b); return b; } - dm_bufio_cond_resched(); + might_resched(); } list_for_each_entry_reverse(b, >lru[LIST_DIRTY], lru_list) { @@ -698,7 +685,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c) __unlink_buffer(b); return b; } - dm_bufio_cond_resched(); + might_resched(); } return NULL; @@ -830,7 +817,7 @@ static void __write_dirty_buffers_async(struct dm_bufio_client *c, int no_wait, return; __write_dirty_buffer(b, write_list); - dm_bufio_cond_resched(); + might_resched(); } } @@ -880,7 +867,7 @@ static void __check_watermark(struct dm_bufio_client *c, return; __free_buffer_wake(b); - dm_bufio_cond_resched(); + might_resched(); } if (c->n_buffers[LIST_DIRTY] > threshold_buffers) @@ -896,7 +883,7 @@ static struct dm_buffer *__find(struct dm_bufio_client *c, sector_t block) hlist_for_each_entry(b, >cache_hash[DM_BUFIO_HASH(block)], hash_list) { - dm_bufio_cond_resched(); + might_resched(); if (b->block == block) return b; } @@ -1090,7 +1077,7 @@ void dm_bufio_prefetch(struct dm_bufio_client *c, submit_io(b, READ, b->block, read_endio); dm_bufio_release(b); - dm_bufio_cond_resched(); + might_resched(); if (!n_blocks) goto flush_plug; @@ -1211,7 +1198,7 @@ again: !test_bit(B_WRITING, >state)) __relink_lru(b, LIST_CLEAN); - dm_bufio_cond_resched(); + might_resched(); /* * If we dropped the lock, the list is no longer consistent, @@ -1473,7 +1460,7 @@ static long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan, freed += __cleanup_old_buffer(b, gfp_mask, 0); if (!--nr_to_scan) return freed; - dm_bufio_cond_resched(); + might_resched(); } } return freed; @@ -1704,11 +1691,11 @@ static void cleanup_old_buffers(void) struct dm_buffer, lru_list); if (!__cleanup_old_buffer(b, 0, max_age * HZ)) break; - dm_bufio_cond_resched(); + might_resched(); } dm_bufio_unlock(c); - dm_bufio_cond_resched(); + might_resched(); } mutex_unlock(_bufio_clients_lock); } -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched, cleanup, dm bufio: Replace dm_bufio_cond_resched with might_resched
The judge of need_resched() before _cond_resched() in dm_bufio_cond_resched() is no need. Because _cond_resched() itself judges should_resched() which means need and can resched. In addition, might_resched() can do all these. Signed-off-by: Yao Dongdong yaodongd...@huawei.com --- drivers/md/dm-bufio.c | 35 +++ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index afe7971..3660a24 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -186,19 +186,6 @@ static void dm_bufio_unlock(struct dm_bufio_client *c) mutex_unlock(c-lock); } -/* - * FIXME Move to sched.h? - */ -#ifdef CONFIG_PREEMPT_VOLUNTARY -# define dm_bufio_cond_resched() \ -do { \ - if (unlikely(need_resched())) \ - _cond_resched();\ -} while (0) -#else -# define dm_bufio_cond_resched()do { } while (0) -#endif - /**/ /* @@ -648,7 +635,7 @@ static void __flush_write_list(struct list_head *write_list) list_entry(write_list-next, struct dm_buffer, write_list); list_del(b-write_list); submit_io(b, WRITE, b-block, write_endio); - dm_bufio_cond_resched(); + might_resched(); } blk_finish_plug(plug); } @@ -687,7 +674,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c) __unlink_buffer(b); return b; } - dm_bufio_cond_resched(); + might_resched(); } list_for_each_entry_reverse(b, c-lru[LIST_DIRTY], lru_list) { @@ -698,7 +685,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c) __unlink_buffer(b); return b; } - dm_bufio_cond_resched(); + might_resched(); } return NULL; @@ -830,7 +817,7 @@ static void __write_dirty_buffers_async(struct dm_bufio_client *c, int no_wait, return; __write_dirty_buffer(b, write_list); - dm_bufio_cond_resched(); + might_resched(); } } @@ -880,7 +867,7 @@ static void __check_watermark(struct dm_bufio_client *c, return; __free_buffer_wake(b); - dm_bufio_cond_resched(); + might_resched(); } if (c-n_buffers[LIST_DIRTY] threshold_buffers) @@ -896,7 +883,7 @@ static struct dm_buffer *__find(struct dm_bufio_client *c, sector_t block) hlist_for_each_entry(b, c-cache_hash[DM_BUFIO_HASH(block)], hash_list) { - dm_bufio_cond_resched(); + might_resched(); if (b-block == block) return b; } @@ -1090,7 +1077,7 @@ void dm_bufio_prefetch(struct dm_bufio_client *c, submit_io(b, READ, b-block, read_endio); dm_bufio_release(b); - dm_bufio_cond_resched(); + might_resched(); if (!n_blocks) goto flush_plug; @@ -1211,7 +1198,7 @@ again: !test_bit(B_WRITING, b-state)) __relink_lru(b, LIST_CLEAN); - dm_bufio_cond_resched(); + might_resched(); /* * If we dropped the lock, the list is no longer consistent, @@ -1473,7 +1460,7 @@ static long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan, freed += __cleanup_old_buffer(b, gfp_mask, 0); if (!--nr_to_scan) return freed; - dm_bufio_cond_resched(); + might_resched(); } } return freed; @@ -1704,11 +1691,11 @@ static void cleanup_old_buffers(void) struct dm_buffer, lru_list); if (!__cleanup_old_buffer(b, 0, max_age * HZ)) break; - dm_bufio_cond_resched(); + might_resched(); } dm_bufio_unlock(c); - dm_bufio_cond_resched(); + might_resched(); } mutex_unlock(dm_bufio_clients_lock); } -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:sched/core] sched: Check if we got a shallowest_idle_cpu before searching for least_loaded_cpu
Commit-ID: 9f96742a13135e6c609cc99a3a458402af3c8f31 Gitweb: http://git.kernel.org/tip/9f96742a13135e6c609cc99a3a458402af3c8f31 Author: Yao Dongdong AuthorDate: Tue, 28 Oct 2014 04:08:06 + Committer: Ingo Molnar CommitDate: Tue, 4 Nov 2014 07:17:51 +0100 sched: Check if we got a shallowest_idle_cpu before searching for least_loaded_cpu Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. Signed-off-by: Yao Dongdong Reviewed-by: Srikar Dronamraju Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Link: http://lkml.kernel.org/r/1414469286-6023-1-git-send-email-yaodongd...@huawei.com Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ec32c26d..d03d76d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4641,7 +4641,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq->idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load < min_load || (load == min_load && i == this_cpu)) { min_load = load; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:sched/core] sched: Check if we got a shallowest_idle_cpu before searching for least_loaded_cpu
Commit-ID: 9f96742a13135e6c609cc99a3a458402af3c8f31 Gitweb: http://git.kernel.org/tip/9f96742a13135e6c609cc99a3a458402af3c8f31 Author: Yao Dongdong yaodongd...@huawei.com AuthorDate: Tue, 28 Oct 2014 04:08:06 + Committer: Ingo Molnar mi...@kernel.org CommitDate: Tue, 4 Nov 2014 07:17:51 +0100 sched: Check if we got a shallowest_idle_cpu before searching for least_loaded_cpu Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. Signed-off-by: Yao Dongdong yaodongd...@huawei.com Reviewed-by: Srikar Dronamraju sri...@linux.vnet.ibm.com Signed-off-by: Peter Zijlstra (Intel) pet...@infradead.org Cc: Linus Torvalds torva...@linux-foundation.org Link: http://lkml.kernel.org/r/1414469286-6023-1-git-send-email-yaodongd...@huawei.com Signed-off-by: Ingo Molnar mi...@kernel.org --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ec32c26d..d03d76d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4641,7 +4641,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq-idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load min_load || (load == min_load i == this_cpu)) { min_load = load; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] Thermal:Fix memory leak if occur goto unregister
On 2014/11/4 2:35, Eduardo Valentin wrote: > Hello, > > On Mon, Nov 03, 2014 at 06:17:37PM +, R, Durgadoss wrote: >>> -Original Message- >>> From: linux-pm-ow...@vger.kernel.org [mailto:linux-pm- >>> ow...@vger.kernel.org] On Behalf Of Eduardo Valentin >>> Sent: Monday, October 20, 2014 6:04 PM >>> To: Yao Dongdong >>> Cc: Zhang, Rui; linux...@vger.kernel.org; LKML >>> Subject: Re: [PATCH 1/2] Thermal:Fix memory leak if occur goto unregister >>> >>> Hello, >>> >>> On Mon, Oct 20, 2014 at 04:27:36PM +0800, Yao Dongdong wrote: >>>> Signed-off-by:yaodongd...@huawei.com >>> Acked-by: Eduardo Valentin >>> >>> Rui, would you take care of this? >>> >> If I remember it right, this 'tz' is freed in the thermal_release() >> function, during device_unregister(). >> >> It is similar in all other functions in thermal_core.c >> >> So, Yao, Did you really test this patch ? >> And did not see any crashes ? >> > Yao, reading the patch change carefully, now I see that Durga is correct > here. > >> Thanks, >> Durga >> >>>> --- >>>> drivers/thermal/thermal_core.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/drivers/thermal/thermal_core.c >>>> b/drivers/thermal/thermal_core.c >>>> index 71b0ec0..5b7d466 100644 >>>> --- a/drivers/thermal/thermal_core.c >>>> +++ b/drivers/thermal/thermal_core.c >>>> @@ -1574,6 +1574,7 @@ struct thermal_zone_device >>> *thermal_zone_device_register(const char *type, >>>> unregister: >>>> release_idr(_tz_idr, _idr_lock, tz->id); >>>> device_unregister(>device); >>>> + kfree(tz); > The device unregister is called above your kfree call, which will cause > the thermal_release to be called. Did you test the code for double kfree > calls? Your patch probably inserts a memory corruption. > > I will revert your patch from my tree until you provide an answer about > your testing. Yes, i have checked it and you are right, the patch will double kfree tz. Thansks Durga for correcting me. > Thanks, > > > Eduardo Valentin > >>>> return ERR_PTR(result); >>>> } >>>> EXPORT_SYMBOL_GPL(thermal_zone_device_register); >>>> -- >>>> 1.8.0.1 >>>> >>>> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] Thermal:Fix memory leak if occur goto unregister
On 2014/11/4 2:35, Eduardo Valentin wrote: Hello, On Mon, Nov 03, 2014 at 06:17:37PM +, R, Durgadoss wrote: -Original Message- From: linux-pm-ow...@vger.kernel.org [mailto:linux-pm- ow...@vger.kernel.org] On Behalf Of Eduardo Valentin Sent: Monday, October 20, 2014 6:04 PM To: Yao Dongdong Cc: Zhang, Rui; linux...@vger.kernel.org; LKML Subject: Re: [PATCH 1/2] Thermal:Fix memory leak if occur goto unregister Hello, On Mon, Oct 20, 2014 at 04:27:36PM +0800, Yao Dongdong wrote: Signed-off-by:yaodongd...@huawei.com Acked-by: Eduardo Valentin edubez...@gmail.com Rui, would you take care of this? If I remember it right, this 'tz' is freed in the thermal_release() function, during device_unregister(). It is similar in all other functions in thermal_core.c So, Yao, Did you really test this patch ? And did not see any crashes ? Yao, reading the patch change carefully, now I see that Durga is correct here. Thanks, Durga --- drivers/thermal/thermal_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 71b0ec0..5b7d466 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1574,6 +1574,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, unregister: release_idr(thermal_tz_idr, thermal_idr_lock, tz-id); device_unregister(tz-device); + kfree(tz); The device unregister is called above your kfree call, which will cause the thermal_release to be called. Did you test the code for double kfree calls? Your patch probably inserts a memory corruption. I will revert your patch from my tree until you provide an answer about your testing. Yes, i have checked it and you are right, the patch will double kfree tz. Thansks Durga for correcting me. Thanks, Eduardo Valentin return ERR_PTR(result); } EXPORT_SYMBOL_GPL(thermal_zone_device_register); -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2 resend] Thermal:Fix memory leak if occur goto unregister
Hello Eduardo, I'm sorry for that my patches listed below have format problems, so i resend them. https://lkml.org/lkml/2014/10/20/85 https://lkml.org/lkml/2014/10/20/84 Thanks, Yao Dongdong -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2 resend] Thermal:Fix memory leak if occur goto unregister
Signed-off-by: Yao Dongdong Acked-by: Eduardo Valentin --- drivers/thermal/thermal_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9bf10aa..d358605 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1581,6 +1581,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, unregister: release_idr(_tz_idr, _idr_lock, tz->id); device_unregister(>device); + kfree(tz); return ERR_PTR(result); } EXPORT_SYMBOL_GPL(thermal_zone_device_register); -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2 resend] Thermal:Remove usless if(!result) before return tz
result is always zero when comes here. Signed-off-by: Yao Dongdong Acked-by: Eduardo Valentin --- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d358605..a438c95 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1575,8 +1575,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, thermal_zone_device_update(tz); - if (!result) - return tz; + return tz; unregister: release_idr(_tz_idr, _idr_lock, tz->id); -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2 resend] Thermal:Remove usless if(!result) before return tz
result is always zero when comes here. Signed-off-by: Yao Dongdong yaodongd...@huawei.com Acked-by: Eduardo Valentin edubez...@gmail.com --- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d358605..a438c95 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1575,8 +1575,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, thermal_zone_device_update(tz); - if (!result) - return tz; + return tz; unregister: release_idr(thermal_tz_idr, thermal_idr_lock, tz-id); -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2 resend] Thermal:Fix memory leak if occur goto unregister
Signed-off-by: Yao Dongdong yaodongd...@huawei.com Acked-by: Eduardo Valentin edubez...@gmail.com --- drivers/thermal/thermal_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9bf10aa..d358605 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1581,6 +1581,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, unregister: release_idr(thermal_tz_idr, thermal_idr_lock, tz-id); device_unregister(tz-device); + kfree(tz); return ERR_PTR(result); } EXPORT_SYMBOL_GPL(thermal_zone_device_register); -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2 resend] Thermal:Fix memory leak if occur goto unregister
Hello Eduardo, I'm sorry for that my patches listed below have format problems, so i resend them. https://lkml.org/lkml/2014/10/20/85 https://lkml.org/lkml/2014/10/20/84 Thanks, Yao Dongdong -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH resend] sched:check if got a shallowest_idle_cpu before search for least_loaded_cpu
Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. Signed-off-by: Yao Dongdong Reviewed-by: Srikar Dronamraju --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf..2445a23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,7 +4446,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq->idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load < min_load || (load == min_load && i == this_cpu)) { min_load = load; -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2]sched:add check of shallowest_idle_cpu before search for least_loaded_cpu
On 2014/10/27 20:30, Peter Zijlstra wrote: > Please as to try again: > > Applying patch > patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch > patching file kernel/sched/fair.c > Hunk #1 FAILED at 4446. > 1 out of 1 hunk FAILED -- rejects in file kernel/sched/fair.c > Patch > patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch > does not apply (enforce with -f) > quilt returned 1, with 0 fuzz and 1 rejects > use quilt -f? y/n [y]: y > Applying patch > patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch > patching file kernel/sched/fair.c > Hunk #1 FAILED at 4446. > 1 out of 1 hunk FAILED -- saving rejects to file kernel/sched/fair.c.rej > Applied patch > patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch > (forced; needs refresh) > reject patch > patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch > file kernel/sched/fair.c hunk 1 line 4 > [a]uto[m]erge,edit [f]ile [p]atch [r]ej,[n]ext,[d]elete: [amfdprn]: m > rej started: > [a]uto[m]erge,edit [f]ile [p]atch [r]ej,[n]ext,[d]elete: [amfdprn]: > kernel/sched/fair.c: 1 matched, 0 conflicts remain > n > patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch > done [s]top, [n]ext, [r]efresh [snr]: r > WARNING: Use a single space after Signed-off-by: > #13: > Signed-off-by:yaodongd...@huawei.com > > ERROR: code indent should use tabs where possible > #25: FILE: kernel/sched/fair.c:4644: > + } else if (shallowest_idle_cpu == -1) {$ > > WARNING: please, no spaces at the start of a line > #25: FILE: kernel/sched/fair.c:4644: > + } else if (shallowest_idle_cpu == -1) {$ > > total: 1 errors, 2 warnings, 8 lines checked > > NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or > scripts/cleanfile > > . > I 'm sorry, and i will fix and resend another one. Thanks, Yao Dongdong -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2]sched:add check of shallowest_idle_cpu before search for least_loaded_cpu
Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. Signed-off-by:yaodongd...@huawei.com Reviewed-by: Srikar Dronamraju --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf..2445a23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,7 +4446,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq->idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load < min_load || (load == min_load && i == this_cpu)) { min_load = load; -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] sched:skip loop non-idle cpus after find an idle cpu while find_idlest_cpu
On 2014/10/27 16:04, Srikar Dronamraju wrote: > * Yao Dongdong [2014-10-27 11:13:17]: > >> Idle cpu is idler than non-idle cpu, so we needn't loop non-idle cpus after >> find an idle cpu. >> > While this check looks good, > I dont see how we are avoiding a loop? > > Are you suggesting that we break of the for loop once we set > shallowest_idle_cpu? > Thanks for your review. I agree that the submit message is a bit misleading, what this patch do is just avoiding search for least_loaded_cpu in non-idle cpus. sched:add check of shallowest_idle_cpu before search for least_loaded_cpu Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. what about this? Thanks, Yao Dongdong -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] sched:skip loop non-idle cpus after find an idle cpu while find_idlest_cpu
On 2014/10/27 16:04, Srikar Dronamraju wrote: * Yao Dongdong yaodongd...@huawei.com [2014-10-27 11:13:17]: Idle cpu is idler than non-idle cpu, so we needn't loop non-idle cpus after find an idle cpu. While this check looks good, I dont see how we are avoiding a loop? Are you suggesting that we break of the for loop once we set shallowest_idle_cpu? Thanks for your review. I agree that the submit message is a bit misleading, what this patch do is just avoiding search for least_loaded_cpu in non-idle cpus. sched:add check of shallowest_idle_cpu before search for least_loaded_cpu Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. what about this? Thanks, Yao Dongdong -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2]sched:add check of shallowest_idle_cpu before search for least_loaded_cpu
Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. Signed-off-by:yaodongd...@huawei.com Reviewed-by: Srikar Dronamraju sri...@linux.vnet.ibm.com --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf..2445a23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,7 +4446,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq-idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load min_load || (load == min_load i == this_cpu)) { min_load = load; -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2]sched:add check of shallowest_idle_cpu before search for least_loaded_cpu
On 2014/10/27 20:30, Peter Zijlstra wrote: Please as to try again: Applying patch patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch patching file kernel/sched/fair.c Hunk #1 FAILED at 4446. 1 out of 1 hunk FAILED -- rejects in file kernel/sched/fair.c Patch patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch does not apply (enforce with -f) quilt returned 1, with 0 fuzz and 1 rejects use quilt -f? y/n [y]: y Applying patch patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch patching file kernel/sched/fair.c Hunk #1 FAILED at 4446. 1 out of 1 hunk FAILED -- saving rejects to file kernel/sched/fair.c.rej Applied patch patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch (forced; needs refresh) reject patch patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch file kernel/sched/fair.c hunk 1 line 4 [a]uto[m]erge,edit [f]ile [p]atch [r]ej,[n]ext,[d]elete: [amfdprn]: m rej started: [a]uto[m]erge,edit [f]ile [p]atch [r]ej,[n]ext,[d]elete: [amfdprn]: kernel/sched/fair.c: 1 matched, 0 conflicts remain n patches/yao_dongdong-sched_add_check_of_shallowest_idle_cpu_before_search_for_least_loaded_cpu.patch done [s]top, [n]ext, [r]efresh [snr]: r WARNING: Use a single space after Signed-off-by: #13: Signed-off-by:yaodongd...@huawei.com ERROR: code indent should use tabs where possible #25: FILE: kernel/sched/fair.c:4644: + } else if (shallowest_idle_cpu == -1) {$ WARNING: please, no spaces at the start of a line #25: FILE: kernel/sched/fair.c:4644: + } else if (shallowest_idle_cpu == -1) {$ total: 1 errors, 2 warnings, 8 lines checked NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or scripts/cleanfile . I 'm sorry, and i will fix and resend another one. Thanks, Yao Dongdong -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH resend] sched:check if got a shallowest_idle_cpu before search for least_loaded_cpu
Idle cpu is idler than non-idle cpu, so we needn't search for least_loaded_cpu after we have found an idle cpu. Signed-off-by: Yao Dongdong yaodongd...@huawei.com Reviewed-by: Srikar Dronamraju sri...@linux.vnet.ibm.com --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf..2445a23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,7 +4446,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq-idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load min_load || (load == min_load i == this_cpu)) { min_load = load; -- 1.8.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched:skip loop non-idle cpus after find an idle cpu while find_idlest_cpu
Idle cpu is idler than non-idle cpu, so we needn't loop non-idle cpus after find an idle cpu. Signed-off-by:yaodongd...@huawei.com --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf..2445a23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,7 +4446,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq->idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load < min_load || (load == min_load && i == this_cpu)) { min_load = load; -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sched:skip loop non-idle cpus after find an idle cpu while find_idlest_cpu
Idle cpu is idler than non-idle cpu, so we needn't loop non-idle cpus after find an idle cpu. Signed-off-by:yaodongd...@huawei.com --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf..2445a23 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4446,7 +4446,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) latest_idle_timestamp = rq-idle_stamp; shallowest_idle_cpu = i; } - } else { + } else if (shallowest_idle_cpu == -1) { load = weighted_cpuload(i); if (load min_load || (load == min_load i == this_cpu)) { min_load = load; -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] Thermal:Remove usless if(!result) before return tz
On 2014/10/20 20:10, Eduardo Valentin wrote: > Hello Yao > > On Mon, Oct 20, 2014 at 04:27:59PM +0800, Yao Dongdong wrote: >> result is always zero when comes here. >> >> Signed-off-by:yaodongd...@huawei.com >> >> --- >> drivers/thermal/thermal_core.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c >> index 5b7d466..19cac8e 100644 >> --- a/drivers/thermal/thermal_core.c >> +++ b/drivers/thermal/thermal_core.c >> @@ -1568,8 +1568,7 @@ struct thermal_zone_device >> *thermal_zone_device_register(const char *type, >> >> thermal_zone_device_update(tz); >> >> - if (!result) >> - return tz; >> + return tz; >> > Adding a return here will make the resource release below not reachable > in the fail path. But all fails above followed a "goto unregister", so i think it must be successful when come here. Thanks. >> unregister: >> release_idr(_tz_idr, _idr_lock, tz->id); >> -- >> 1.8.0.1 >> >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] Thermal:Fix memory leak if occur goto unregister
Signed-off-by:yaodongd...@huawei.com --- drivers/thermal/thermal_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 71b0ec0..5b7d466 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1574,6 +1574,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, unregister: release_idr(_tz_idr, _idr_lock, tz->id); device_unregister(>device); + kfree(tz); return ERR_PTR(result); } EXPORT_SYMBOL_GPL(thermal_zone_device_register); -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] Thermal:Remove usless if(!result) before return tz
result is always zero when comes here. Signed-off-by:yaodongd...@huawei.com --- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5b7d466..19cac8e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, thermal_zone_device_update(tz); - if (!result) - return tz; + return tz; unregister: release_idr(_tz_idr, _idr_lock, tz->id); -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] Thermal:Fix memory leak if occur goto unregister
Signed-off-by:yaodongd...@huawei.com --- drivers/thermal/thermal_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 71b0ec0..5b7d466 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1574,6 +1574,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, unregister: release_idr(thermal_tz_idr, thermal_idr_lock, tz-id); device_unregister(tz-device); + kfree(tz); return ERR_PTR(result); } EXPORT_SYMBOL_GPL(thermal_zone_device_register); -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] Thermal:Remove usless if(!result) before return tz
result is always zero when comes here. Signed-off-by:yaodongd...@huawei.com --- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5b7d466..19cac8e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, thermal_zone_device_update(tz); - if (!result) - return tz; + return tz; unregister: release_idr(thermal_tz_idr, thermal_idr_lock, tz-id); -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] Thermal:Remove usless if(!result) before return tz
On 2014/10/20 20:10, Eduardo Valentin wrote: Hello Yao On Mon, Oct 20, 2014 at 04:27:59PM +0800, Yao Dongdong wrote: result is always zero when comes here. Signed-off-by:yaodongd...@huawei.com --- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 5b7d466..19cac8e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1568,8 +1568,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, thermal_zone_device_update(tz); - if (!result) - return tz; + return tz; Adding a return here will make the resource release below not reachable in the fail path. But all fails above followed a goto unregister, so i think it must be successful when come here. Thanks. unregister: release_idr(thermal_tz_idr, thermal_idr_lock, tz-id); -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] sched/fair: leverage the idle state info when choosing the "idlest" cpu
On 2014/9/4 23:32, Nicolas Pitre wrote: > The code in find_idlest_cpu() looks for the CPU with the smallest load. > However, if multiple CPUs are idle, the first idle CPU is selected > irrespective of the depth of its idle state. > > Among the idle CPUs we should pick the one with with the shallowest idle > state, or the latest to have gone idle if all idle CPUs are in the same > state. The later applies even when cpuidle is configured out. > > This patch doesn't cover the following issues: > > - The idle exit latency of a CPU might be larger than the time needed > to migrate the waking task to an already running CPU with sufficient > capacity, and therefore performance would benefit from task packing > in such case (in most cases task packing is about power saving). > > - Some idle states have a non negligible and non abortable entry latency > which needs to run to completion before the exit latency can start. > A concurrent patch series is making this info available to the cpuidle > core. Once available, the entry latency with the idle timestamp could > determine when the exit latency may be effective. > > Those issues will be handled in due course. In the mean time, what > is implemented here should improve things already compared to the current > state of affairs. > > Based on an initial patch from Daniel Lezcano. > > Signed-off-by: Nicolas Pitre > --- > kernel/sched/fair.c | 43 --- > 1 file changed, 36 insertions(+), 7 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index bfa3c86d0d..416329e1a6 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -4428,20 +4429,48 @@ static int > find_idlest_cpu(struct sched_group *group, struct task_struct *p, int > this_cpu) > { > unsigned long load, min_load = ULONG_MAX; > - int idlest = -1; > + unsigned int min_exit_latency = UINT_MAX; > + u64 latest_idle_timestamp = 0; > + int least_loaded_cpu = this_cpu; > + int shallowest_idle_cpu = -1; > int i; > > /* Traverse only the allowed CPUs */ > for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) { > - load = weighted_cpuload(i); > - > - if (load < min_load || (load == min_load && i == this_cpu)) { > - min_load = load; > - idlest = i; > + if (idle_cpu(i)) { > + struct rq *rq = cpu_rq(i); > + struct cpuidle_state *idle = idle_get_state(rq); > + if (idle && idle->exit_latency < min_exit_latency) { > + /* > + * We give priority to a CPU whose idle state > + * has the smallest exit latency irrespective > + * of any idle timestamp. > + */ > + min_exit_latency = idle->exit_latency; > + latest_idle_timestamp = rq->idle_stamp; > + shallowest_idle_cpu = i; > + } else if ((!idle || idle->exit_latency == > min_exit_latency) && > +rq->idle_stamp > latest_idle_timestamp) { > + /* > + * If equal or no active idle state, then > + * the most recently idled CPU might have > + * a warmer cache. > + */ > + latest_idle_timestamp = rq->idle_stamp; > + shallowest_idle_cpu = i; > + } > + cpuidle_put_state(rq); > + } else { I think we needn't test no idle cpus after find an idle cpu. And what about this? } else if (shallowest_idle_cpu == -1) { > + load = weighted_cpuload(i); > + if (load < min_load || > + (load == min_load && i == this_cpu)) { > + min_load = load; > + least_loaded_cpu = i; > + } > } > } > > - return idlest; > + return shallowest_idle_cpu != -1 ? shallowest_idle_cpu : > least_loaded_cpu; > } > > /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/2] sched/fair: leverage the idle state info when choosing the idlest cpu
On 2014/9/4 23:32, Nicolas Pitre wrote: The code in find_idlest_cpu() looks for the CPU with the smallest load. However, if multiple CPUs are idle, the first idle CPU is selected irrespective of the depth of its idle state. Among the idle CPUs we should pick the one with with the shallowest idle state, or the latest to have gone idle if all idle CPUs are in the same state. The later applies even when cpuidle is configured out. This patch doesn't cover the following issues: - The idle exit latency of a CPU might be larger than the time needed to migrate the waking task to an already running CPU with sufficient capacity, and therefore performance would benefit from task packing in such case (in most cases task packing is about power saving). - Some idle states have a non negligible and non abortable entry latency which needs to run to completion before the exit latency can start. A concurrent patch series is making this info available to the cpuidle core. Once available, the entry latency with the idle timestamp could determine when the exit latency may be effective. Those issues will be handled in due course. In the mean time, what is implemented here should improve things already compared to the current state of affairs. Based on an initial patch from Daniel Lezcano. Signed-off-by: Nicolas Pitre n...@linaro.org --- kernel/sched/fair.c | 43 --- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bfa3c86d0d..416329e1a6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -23,6 +23,7 @@ #include linux/latencytop.h #include linux/sched.h #include linux/cpumask.h +#include linux/cpuidle.h #include linux/slab.h #include linux/profile.h #include linux/interrupt.h @@ -4428,20 +4429,48 @@ static int find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu) { unsigned long load, min_load = ULONG_MAX; - int idlest = -1; + unsigned int min_exit_latency = UINT_MAX; + u64 latest_idle_timestamp = 0; + int least_loaded_cpu = this_cpu; + int shallowest_idle_cpu = -1; int i; /* Traverse only the allowed CPUs */ for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) { - load = weighted_cpuload(i); - - if (load min_load || (load == min_load i == this_cpu)) { - min_load = load; - idlest = i; + if (idle_cpu(i)) { + struct rq *rq = cpu_rq(i); + struct cpuidle_state *idle = idle_get_state(rq); + if (idle idle-exit_latency min_exit_latency) { + /* + * We give priority to a CPU whose idle state + * has the smallest exit latency irrespective + * of any idle timestamp. + */ + min_exit_latency = idle-exit_latency; + latest_idle_timestamp = rq-idle_stamp; + shallowest_idle_cpu = i; + } else if ((!idle || idle-exit_latency == min_exit_latency) +rq-idle_stamp latest_idle_timestamp) { + /* + * If equal or no active idle state, then + * the most recently idled CPU might have + * a warmer cache. + */ + latest_idle_timestamp = rq-idle_stamp; + shallowest_idle_cpu = i; + } + cpuidle_put_state(rq); + } else { I think we needn't test no idle cpus after find an idle cpu. And what about this? } else if (shallowest_idle_cpu == -1) { + load = weighted_cpuload(i); + if (load min_load || + (load == min_load i == this_cpu)) { + min_load = load; + least_loaded_cpu = i; + } } } - return idlest; + return shallowest_idle_cpu != -1 ? shallowest_idle_cpu : least_loaded_cpu; } /* -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Documentation/memory-barriers.txt: match table to its comment followed
On 2014/9/16 17:24, Jianyu Zhan wrote: > Hi, > > Some one has submitted a patch addressing this issue a few days ago. > The patch is now being cooked in the paulk's tree now, IIRC. > > Thanks, > Jianyu Zhan > I have found the patch you mentioned. Thanks > On Tue, Sep 16, 2014 at 4:51 PM, Yao Dongdong wrote: >> The table shows CPU2's sequence of events as "x = B; y = A;", but its >> comment followed >> described as "x = A; y = B;". >> >> Signed-off-by: Yao Dongdong >> --- >> Documentation/memory-barriers.txt | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/memory-barriers.txt >> b/Documentation/memory-barriers.txt >> index a4de88f..9a46bbe 100644 >> --- a/Documentation/memory-barriers.txt >> +++ b/Documentation/memory-barriers.txt >> @@ -115,8 +115,8 @@ For example, consider the following sequence of events: >> CPU 1 CPU 2 >> === === >> { A == 1; B == 2 } >> - A = 3; x = B; >> - B = 4; y = A; >> + A = 3; x = A; >> + B = 4; y = B; >> >> The set of accesses as seen by the memory system in the middle can be >> arranged >> in 24 different combinations: >> -- >> 1.8.0.1 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Documentation/memory-barriers.txt: match table to its comment followed
The table shows CPU2's sequence of events as "x = B; y = A;", but its comment followed described as "x = A; y = B;". Signed-off-by: Yao Dongdong --- Documentation/memory-barriers.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index a4de88f..9a46bbe 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -115,8 +115,8 @@ For example, consider the following sequence of events: CPU 1 CPU 2 === === { A == 1; B == 2 } - A = 3; x = B; - B = 4; y = A; + A = 3; x = A; + B = 4; y = B; The set of accesses as seen by the memory system in the middle can be arranged in 24 different combinations: -- 1.8.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Documentation/memory-barriers.txt: match table to its comment followed
The table shows CPU2's sequence of events as x = B; y = A;, but its comment followed described as x = A; y = B;. Signed-off-by: Yao Dongdong yaodongd...@huawei.com --- Documentation/memory-barriers.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index a4de88f..9a46bbe 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -115,8 +115,8 @@ For example, consider the following sequence of events: CPU 1 CPU 2 === === { A == 1; B == 2 } - A = 3; x = B; - B = 4; y = A; + A = 3; x = A; + B = 4; y = B; The set of accesses as seen by the memory system in the middle can be arranged in 24 different combinations: -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Documentation/memory-barriers.txt: match table to its comment followed
On 2014/9/16 17:24, Jianyu Zhan wrote: Hi, Some one has submitted a patch addressing this issue a few days ago. The patch is now being cooked in the paulk's tree now, IIRC. Thanks, Jianyu Zhan I have found the patch you mentioned. Thanks On Tue, Sep 16, 2014 at 4:51 PM, Yao Dongdong yaodongd...@huawei.com wrote: The table shows CPU2's sequence of events as x = B; y = A;, but its comment followed described as x = A; y = B;. Signed-off-by: Yao Dongdong yaodongd...@huawei.com --- Documentation/memory-barriers.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index a4de88f..9a46bbe 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -115,8 +115,8 @@ For example, consider the following sequence of events: CPU 1 CPU 2 === === { A == 1; B == 2 } - A = 3; x = B; - B = 4; y = A; + A = 3; x = A; + B = 4; y = B; The set of accesses as seen by the memory system in the middle can be arranged in 24 different combinations: -- 1.8.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/