Skip to content

Commit f2a8417

Browse files
committed
Merge branch 'for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
Pull percpu updates from Tejun Heo: - Major reorganization of percpu header files which I think makes things a lot more readable and logical than before. - percpu-refcount is updated so that it requires explicit destruction and can be reinitialized if necessary. This was pulled into the block tree to replace the custom percpu refcnting implemented in blk-mq. - In the process, percpu and percpu-refcount got cleaned up a bit * 'for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (21 commits) percpu-refcount: implement percpu_ref_reinit() and percpu_ref_is_zero() percpu-refcount: require percpu_ref to be exited explicitly percpu-refcount: use unsigned long for pcpu_count pointer percpu-refcount: add helpers for ->percpu_count accesses percpu-refcount: one bit is enough for REF_STATUS percpu-refcount, aio: use percpu_ref_cancel_init() in ioctx_alloc() workqueue: stronger test in process_one_work() workqueue: clear POOL_DISASSOCIATED in rebind_workers() percpu: Use ALIGN macro instead of hand coding alignment calculation percpu: invoke __verify_pcpu_ptr() from the generic part of accessors and operations percpu: preffity percpu header files percpu: use raw_cpu_*() to define __this_cpu_*() percpu: reorder macros in percpu header files percpu: move {raw|this}_cpu_*() definitions to include/linux/percpu-defs.h percpu: move generic {raw|this}_cpu_*_N() definitions to include/asm-generic/percpu.h percpu: only allow sized arch overrides for {raw|this}_cpu_*() ops percpu: reorganize include/linux/percpu-defs.h percpu: move accessors from include/linux/percpu.h to percpu-defs.h percpu: include/asm-generic/percpu.h should contain only arch-overridable parts percpu: introduce arch_raw_cpu_ptr() ...
2 parents c4c3f5f + 2d72278 commit f2a8417

11 files changed

Lines changed: 832 additions & 811 deletions

File tree

‎arch/x86/include/asm/percpu.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@
5252
* Compared to the generic __my_cpu_offset version, the following
5353
* saves one instruction and avoids clobbering a temp register.
5454
*/
55-
#define raw_cpu_ptr(ptr) \
55+
#define arch_raw_cpu_ptr(ptr) \
5656
({ \
5757
unsigned long tcp_ptr__; \
58-
__verify_pcpu_ptr(ptr); \
5958
asm volatile("add " __percpu_arg(1) ", %0" \
6059
: "=r" (tcp_ptr__) \
6160
: "m" (this_cpu_off), "0" (ptr)); \

‎drivers/target/target_core_tpg.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ int core_tpg_add_lun(
825825

826826
ret = core_dev_export(dev, tpg, lun);
827827
if (ret < 0) {
828-
percpu_ref_cancel_init(&lun->lun_ref);
828+
percpu_ref_exit(&lun->lun_ref);
829829
return ret;
830830
}
831831

@@ -880,5 +880,7 @@ int core_tpg_post_dellun(
880880
lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
881881
spin_unlock(&tpg->tpg_lun_lock);
882882

883+
percpu_ref_exit(&lun->lun_ref);
884+
883885
return 0;
884886
}

‎fs/aio.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ static void free_ioctx(struct work_struct *work)
506506

507507
aio_free_ring(ctx);
508508
free_percpu(ctx->cpu);
509+
percpu_ref_exit(&ctx->reqs);
510+
percpu_ref_exit(&ctx->users);
509511
kmem_cache_free(kioctx_cachep, ctx);
510512
}
511513

@@ -715,8 +717,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
715717
err:
716718
mutex_unlock(&ctx->ring_lock);
717719
free_percpu(ctx->cpu);
718-
free_percpu(ctx->reqs.pcpu_count);
719-
free_percpu(ctx->users.pcpu_count);
720+
percpu_ref_exit(&ctx->reqs);
721+
percpu_ref_exit(&ctx->users);
720722
kmem_cache_free(kioctx_cachep, ctx);
721723
pr_debug("error allocating ioctx %d\n", err);
722724
return ERR_PTR(err);

0 commit comments

Comments
 (0)