Skip to content

Commit 0342cbc

Browse files
committed
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rcu: Fix wrong check in list_splice_init_rcu() net,rcu: Convert call_rcu(xt_rateest_free_rcu) to kfree_rcu() sysctl,rcu: Convert call_rcu(free_head) to kfree vmalloc,rcu: Convert call_rcu(rcu_free_vb) to kfree_rcu() vmalloc,rcu: Convert call_rcu(rcu_free_va) to kfree_rcu() ipc,rcu: Convert call_rcu(ipc_immediate_free) to kfree_rcu() ipc,rcu: Convert call_rcu(free_un) to kfree_rcu() security,rcu: Convert call_rcu(sel_netport_free) to kfree_rcu() security,rcu: Convert call_rcu(sel_netnode_free) to kfree_rcu() ia64,rcu: Convert call_rcu(sn_irq_info_free) to kfree_rcu() block,rcu: Convert call_rcu(disk_free_ptbl_rcu_cb) to kfree_rcu() scsi,rcu: Convert call_rcu(fc_rport_free_rcu) to kfree_rcu() audit_tree,rcu: Convert call_rcu(__put_tree) to kfree_rcu() security,rcu: Convert call_rcu(whitelist_item_free) to kfree_rcu() md,rcu: Convert call_rcu(free_conf) to kfree_rcu()
2 parents 391d627 + 7f70893 commit 0342cbc

14 files changed

Lines changed: 21 additions & 148 deletions

File tree

‎arch/ia64/sn/kernel/irq.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ static void sn_ack_irq(struct irq_data *data)
112112
irq_move_irq(data);
113113
}
114114

115-
static void sn_irq_info_free(struct rcu_head *head);
116-
117115
struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
118116
nasid_t nasid, int slice)
119117
{
@@ -177,7 +175,7 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
177175
spin_lock(&sn_irq_info_lock);
178176
list_replace_rcu(&sn_irq_info->list, &new_irq_info->list);
179177
spin_unlock(&sn_irq_info_lock);
180-
call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
178+
kfree_rcu(sn_irq_info, rcu);
181179

182180

183181
finish_up:
@@ -338,14 +336,6 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info)
338336
rcu_read_unlock();
339337
}
340338

341-
static void sn_irq_info_free(struct rcu_head *head)
342-
{
343-
struct sn_irq_info *sn_irq_info;
344-
345-
sn_irq_info = container_of(head, struct sn_irq_info, rcu);
346-
kfree(sn_irq_info);
347-
}
348-
349339
void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
350340
{
351341
nasid_t nasid = sn_irq_info->irq_nasid;
@@ -399,7 +389,7 @@ void sn_irq_unfixup(struct pci_dev *pci_dev)
399389
spin_unlock(&sn_irq_info_lock);
400390
if (list_empty(sn_irq_lh[sn_irq_info->irq_irq]))
401391
free_irq_vector(sn_irq_info->irq_irq);
402-
call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
392+
kfree_rcu(sn_irq_info, rcu);
403393
pci_dev_put(pci_dev);
404394

405395
}

‎block/genhd.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,14 +1018,6 @@ static const struct attribute_group *disk_attr_groups[] = {
10181018
NULL
10191019
};
10201020

1021-
static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
1022-
{
1023-
struct disk_part_tbl *ptbl =
1024-
container_of(head, struct disk_part_tbl, rcu_head);
1025-
1026-
kfree(ptbl);
1027-
}
1028-
10291021
/**
10301022
* disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way
10311023
* @disk: disk to replace part_tbl for
@@ -1046,7 +1038,7 @@ static void disk_replace_part_tbl(struct gendisk *disk,
10461038

10471039
if (old_ptbl) {
10481040
rcu_assign_pointer(old_ptbl->last_lookup, NULL);
1049-
call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb);
1041+
kfree_rcu(old_ptbl, rcu_head);
10501042
}
10511043
}
10521044

‎drivers/md/linear.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,6 @@ static int linear_run (mddev_t *mddev)
213213
return md_integrity_register(mddev);
214214
}
215215

216-
static void free_conf(struct rcu_head *head)
217-
{
218-
linear_conf_t *conf = container_of(head, linear_conf_t, rcu);
219-
kfree(conf);
220-
}
221-
222216
static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
223217
{
224218
/* Adding a drive to a linear array allows the array to grow.
@@ -247,7 +241,7 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
247241
md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
248242
set_capacity(mddev->gendisk, mddev->array_sectors);
249243
revalidate_disk(mddev->gendisk);
250-
call_rcu(&oldconf->rcu, free_conf);
244+
kfree_rcu(oldconf, rcu);
251245
return 0;
252246
}
253247

‎drivers/scsi/libfc/fc_rport.c‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,6 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
152152
return rdata;
153153
}
154154

155-
/**
156-
* fc_rport_free_rcu() - Free a remote port
157-
* @rcu: The rcu_head structure inside the remote port
158-
*/
159-
static void fc_rport_free_rcu(struct rcu_head *rcu)
160-
{
161-
struct fc_rport_priv *rdata;
162-
163-
rdata = container_of(rcu, struct fc_rport_priv, rcu);
164-
kfree(rdata);
165-
}
166-
167155
/**
168156
* fc_rport_destroy() - Free a remote port after last reference is released
169157
* @kref: The remote port's kref
@@ -173,7 +161,7 @@ static void fc_rport_destroy(struct kref *kref)
173161
struct fc_rport_priv *rdata;
174162

175163
rdata = container_of(kref, struct fc_rport_priv, kref);
176-
call_rcu(&rdata->rcu, fc_rport_free_rcu);
164+
kfree_rcu(rdata, rcu);
177165
}
178166

179167
/**

‎include/linux/rculist.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
183183
struct list_head *last = list->prev;
184184
struct list_head *at = head->next;
185185

186-
if (list_empty(head))
186+
if (list_empty(list))
187187
return;
188188

189189
/* "first" and "last" tracking list, so initialize it. */

‎ipc/sem.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -689,12 +689,6 @@ static int count_semzcnt (struct sem_array * sma, ushort semnum)
689689
return semzcnt;
690690
}
691691

692-
static void free_un(struct rcu_head *head)
693-
{
694-
struct sem_undo *un = container_of(head, struct sem_undo, rcu);
695-
kfree(un);
696-
}
697-
698692
/* Free a semaphore set. freeary() is called with sem_ids.rw_mutex locked
699693
* as a writer and the spinlock for this semaphore set hold. sem_ids.rw_mutex
700694
* remains locked on exit.
@@ -714,7 +708,7 @@ static void freeary(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
714708
un->semid = -1;
715709
list_del_rcu(&un->list_proc);
716710
spin_unlock(&un->ulp->lock);
717-
call_rcu(&un->rcu, free_un);
711+
kfree_rcu(un, rcu);
718712
}
719713

720714
/* Wake up all pending processes and let them fail with EIDRM. */
@@ -1612,7 +1606,7 @@ void exit_sem(struct task_struct *tsk)
16121606
sem_unlock(sma);
16131607
wake_up_sem_queue_do(&tasks);
16141608

1615-
call_rcu(&un->rcu, free_un);
1609+
kfree_rcu(un, rcu);
16161610
}
16171611
kfree(ulp);
16181612
}

‎ipc/util.c‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -579,19 +579,6 @@ static void ipc_schedule_free(struct rcu_head *head)
579579
schedule_work(&sched->work);
580580
}
581581

582-
/**
583-
* ipc_immediate_free - free ipc + rcu space
584-
* @head: RCU callback structure that contains pointer to be freed
585-
*
586-
* Free from the RCU callback context.
587-
*/
588-
static void ipc_immediate_free(struct rcu_head *head)
589-
{
590-
struct ipc_rcu_grace *free =
591-
container_of(head, struct ipc_rcu_grace, rcu);
592-
kfree(free);
593-
}
594-
595582
void ipc_rcu_putref(void *ptr)
596583
{
597584
if (--container_of(ptr, struct ipc_rcu_hdr, data)->refcount > 0)
@@ -601,8 +588,7 @@ void ipc_rcu_putref(void *ptr)
601588
call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,
602589
ipc_schedule_free);
603590
} else {
604-
call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,
605-
ipc_immediate_free);
591+
kfree_rcu(container_of(ptr, struct ipc_rcu_grace, data), rcu);
606592
}
607593
}
608594

‎kernel/audit_tree.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,10 @@ static inline void get_tree(struct audit_tree *tree)
9393
atomic_inc(&tree->count);
9494
}
9595

96-
static void __put_tree(struct rcu_head *rcu)
97-
{
98-
struct audit_tree *tree = container_of(rcu, struct audit_tree, head);
99-
kfree(tree);
100-
}
101-
10296
static inline void put_tree(struct audit_tree *tree)
10397
{
10498
if (atomic_dec_and_test(&tree->count))
105-
call_rcu(&tree->head, __put_tree);
99+
kfree_rcu(tree, head);
106100
}
107101

108102
/* to avoid bringing the entire thing in audit.h */

‎kernel/sysctl.c‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,16 +1590,11 @@ void sysctl_head_get(struct ctl_table_header *head)
15901590
spin_unlock(&sysctl_lock);
15911591
}
15921592

1593-
static void free_head(struct rcu_head *rcu)
1594-
{
1595-
kfree(container_of(rcu, struct ctl_table_header, rcu));
1596-
}
1597-
15981593
void sysctl_head_put(struct ctl_table_header *head)
15991594
{
16001595
spin_lock(&sysctl_lock);
16011596
if (!--head->count)
1602-
call_rcu(&head->rcu, free_head);
1597+
kfree_rcu(head, rcu);
16031598
spin_unlock(&sysctl_lock);
16041599
}
16051600

@@ -1971,10 +1966,10 @@ void unregister_sysctl_table(struct ctl_table_header * header)
19711966
start_unregistering(header);
19721967
if (!--header->parent->count) {
19731968
WARN_ON(1);
1974-
call_rcu(&header->parent->rcu, free_head);
1969+
kfree_rcu(header->parent, rcu);
19751970
}
19761971
if (!--header->count)
1977-
call_rcu(&header->rcu, free_head);
1972+
kfree_rcu(header, rcu);
19781973
spin_unlock(&sysctl_lock);
19791974
}
19801975

‎mm/vmalloc.c‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,6 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
452452
return ERR_PTR(-EBUSY);
453453
}
454454

455-
static void rcu_free_va(struct rcu_head *head)
456-
{
457-
struct vmap_area *va = container_of(head, struct vmap_area, rcu_head);
458-
459-
kfree(va);
460-
}
461-
462455
static void __free_vmap_area(struct vmap_area *va)
463456
{
464457
BUG_ON(RB_EMPTY_NODE(&va->rb_node));
@@ -491,7 +484,7 @@ static void __free_vmap_area(struct vmap_area *va)
491484
if (va->va_end > VMALLOC_START && va->va_end <= VMALLOC_END)
492485
vmap_area_pcpu_hole = max(vmap_area_pcpu_hole, va->va_end);
493486

494-
call_rcu(&va->rcu_head, rcu_free_va);
487+
kfree_rcu(va, rcu_head);
495488
}
496489

497490
/*
@@ -837,13 +830,6 @@ static struct vmap_block *new_vmap_block(gfp_t gfp_mask)
837830
return vb;
838831
}
839832

840-
static void rcu_free_vb(struct rcu_head *head)
841-
{
842-
struct vmap_block *vb = container_of(head, struct vmap_block, rcu_head);
843-
844-
kfree(vb);
845-
}
846-
847833
static void free_vmap_block(struct vmap_block *vb)
848834
{
849835
struct vmap_block *tmp;
@@ -856,7 +842,7 @@ static void free_vmap_block(struct vmap_block *vb)
856842
BUG_ON(tmp != vb);
857843

858844
free_vmap_area_noflush(vb->va);
859-
call_rcu(&vb->rcu_head, rcu_free_vb);
845+
kfree_rcu(vb, rcu_head);
860846
}
861847

862848
static void purge_fragmented_blocks(int cpu)

0 commit comments

Comments
 (0)