mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
Merge branch 'for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue changes from Tejun Heo: "This contains only one commit which cleans up UP allocation path a bit." * 'for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: use percpu allocator for cwq on UP
This commit is contained in:
commit
e45836fafe
1 changed files with 3 additions and 19 deletions
|
@ -476,13 +476,8 @@ static struct cpu_workqueue_struct *get_cwq(unsigned int cpu,
|
||||||
struct workqueue_struct *wq)
|
struct workqueue_struct *wq)
|
||||||
{
|
{
|
||||||
if (!(wq->flags & WQ_UNBOUND)) {
|
if (!(wq->flags & WQ_UNBOUND)) {
|
||||||
if (likely(cpu < nr_cpu_ids)) {
|
if (likely(cpu < nr_cpu_ids))
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
return per_cpu_ptr(wq->cpu_wq.pcpu, cpu);
|
return per_cpu_ptr(wq->cpu_wq.pcpu, cpu);
|
||||||
#else
|
|
||||||
return wq->cpu_wq.single;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} else if (likely(cpu == WORK_CPU_UNBOUND))
|
} else if (likely(cpu == WORK_CPU_UNBOUND))
|
||||||
return wq->cpu_wq.single;
|
return wq->cpu_wq.single;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2899,13 +2894,8 @@ static int alloc_cwqs(struct workqueue_struct *wq)
|
||||||
const size_t size = sizeof(struct cpu_workqueue_struct);
|
const size_t size = sizeof(struct cpu_workqueue_struct);
|
||||||
const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
|
const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
|
||||||
__alignof__(unsigned long long));
|
__alignof__(unsigned long long));
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
bool percpu = !(wq->flags & WQ_UNBOUND);
|
|
||||||
#else
|
|
||||||
bool percpu = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (percpu)
|
if (!(wq->flags & WQ_UNBOUND))
|
||||||
wq->cpu_wq.pcpu = __alloc_percpu(size, align);
|
wq->cpu_wq.pcpu = __alloc_percpu(size, align);
|
||||||
else {
|
else {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
@ -2929,13 +2919,7 @@ static int alloc_cwqs(struct workqueue_struct *wq)
|
||||||
|
|
||||||
static void free_cwqs(struct workqueue_struct *wq)
|
static void free_cwqs(struct workqueue_struct *wq)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
if (!(wq->flags & WQ_UNBOUND))
|
||||||
bool percpu = !(wq->flags & WQ_UNBOUND);
|
|
||||||
#else
|
|
||||||
bool percpu = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (percpu)
|
|
||||||
free_percpu(wq->cpu_wq.pcpu);
|
free_percpu(wq->cpu_wq.pcpu);
|
||||||
else if (wq->cpu_wq.single) {
|
else if (wq->cpu_wq.single) {
|
||||||
/* the pointer to free is stored right after the cwq */
|
/* the pointer to free is stored right after the cwq */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue