Skip to content

Commit

Permalink
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/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()
  • Loading branch information
Linus Torvalds committed Jul 22, 2011
2 parents 391d627 + 7f70893 commit 0342cbc
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 148 deletions.
14 changes: 2 additions & 12 deletions arch/ia64/sn/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ static void sn_ack_irq(struct irq_data *data)
irq_move_irq(data);
}

static void sn_irq_info_free(struct rcu_head *head);

struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
nasid_t nasid, int slice)
{
Expand Down Expand Up @@ -177,7 +175,7 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
spin_lock(&sn_irq_info_lock);
list_replace_rcu(&sn_irq_info->list, &new_irq_info->list);
spin_unlock(&sn_irq_info_lock);
call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
kfree_rcu(sn_irq_info, rcu);


finish_up:
Expand Down Expand Up @@ -338,14 +336,6 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info)
rcu_read_unlock();
}

static void sn_irq_info_free(struct rcu_head *head)
{
struct sn_irq_info *sn_irq_info;

sn_irq_info = container_of(head, struct sn_irq_info, rcu);
kfree(sn_irq_info);
}

void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
{
nasid_t nasid = sn_irq_info->irq_nasid;
Expand Down Expand Up @@ -399,7 +389,7 @@ void sn_irq_unfixup(struct pci_dev *pci_dev)
spin_unlock(&sn_irq_info_lock);
if (list_empty(sn_irq_lh[sn_irq_info->irq_irq]))
free_irq_vector(sn_irq_info->irq_irq);
call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
kfree_rcu(sn_irq_info, rcu);
pci_dev_put(pci_dev);

}
Expand Down
10 changes: 1 addition & 9 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,14 +1018,6 @@ static const struct attribute_group *disk_attr_groups[] = {
NULL
};

static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
{
struct disk_part_tbl *ptbl =
container_of(head, struct disk_part_tbl, rcu_head);

kfree(ptbl);
}

/**
* disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way
* @disk: disk to replace part_tbl for
Expand All @@ -1046,7 +1038,7 @@ static void disk_replace_part_tbl(struct gendisk *disk,

if (old_ptbl) {
rcu_assign_pointer(old_ptbl->last_lookup, NULL);
call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb);
kfree_rcu(old_ptbl, rcu_head);
}
}

Expand Down
8 changes: 1 addition & 7 deletions drivers/md/linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ static int linear_run (mddev_t *mddev)
return md_integrity_register(mddev);
}

static void free_conf(struct rcu_head *head)
{
linear_conf_t *conf = container_of(head, linear_conf_t, rcu);
kfree(conf);
}

static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
{
/* Adding a drive to a linear array allows the array to grow.
Expand Down Expand Up @@ -247,7 +241,7 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
md_set_array_sectors(mddev, linear_size(mddev, 0, 0));
set_capacity(mddev->gendisk, mddev->array_sectors);
revalidate_disk(mddev->gendisk);
call_rcu(&oldconf->rcu, free_conf);
kfree_rcu(oldconf, rcu);
return 0;
}

Expand Down
14 changes: 1 addition & 13 deletions drivers/scsi/libfc/fc_rport.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,6 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
return rdata;
}

/**
* fc_rport_free_rcu() - Free a remote port
* @rcu: The rcu_head structure inside the remote port
*/
static void fc_rport_free_rcu(struct rcu_head *rcu)
{
struct fc_rport_priv *rdata;

rdata = container_of(rcu, struct fc_rport_priv, rcu);
kfree(rdata);
}

/**
* fc_rport_destroy() - Free a remote port after last reference is released
* @kref: The remote port's kref
Expand All @@ -173,7 +161,7 @@ static void fc_rport_destroy(struct kref *kref)
struct fc_rport_priv *rdata;

rdata = container_of(kref, struct fc_rport_priv, kref);
call_rcu(&rdata->rcu, fc_rport_free_rcu);
kfree_rcu(rdata, rcu);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion include/linux/rculist.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
struct list_head *last = list->prev;
struct list_head *at = head->next;

if (list_empty(head))
if (list_empty(list))
return;

/* "first" and "last" tracking list, so initialize it. */
Expand Down
10 changes: 2 additions & 8 deletions ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,6 @@ static int count_semzcnt (struct sem_array * sma, ushort semnum)
return semzcnt;
}

static void free_un(struct rcu_head *head)
{
struct sem_undo *un = container_of(head, struct sem_undo, rcu);
kfree(un);
}

/* Free a semaphore set. freeary() is called with sem_ids.rw_mutex locked
* as a writer and the spinlock for this semaphore set hold. sem_ids.rw_mutex
* remains locked on exit.
Expand All @@ -714,7 +708,7 @@ static void freeary(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
un->semid = -1;
list_del_rcu(&un->list_proc);
spin_unlock(&un->ulp->lock);
call_rcu(&un->rcu, free_un);
kfree_rcu(un, rcu);
}

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

call_rcu(&un->rcu, free_un);
kfree_rcu(un, rcu);
}
kfree(ulp);
}
Expand Down
16 changes: 1 addition & 15 deletions ipc/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,19 +579,6 @@ static void ipc_schedule_free(struct rcu_head *head)
schedule_work(&sched->work);
}

/**
* ipc_immediate_free - free ipc + rcu space
* @head: RCU callback structure that contains pointer to be freed
*
* Free from the RCU callback context.
*/
static void ipc_immediate_free(struct rcu_head *head)
{
struct ipc_rcu_grace *free =
container_of(head, struct ipc_rcu_grace, rcu);
kfree(free);
}

void ipc_rcu_putref(void *ptr)
{
if (--container_of(ptr, struct ipc_rcu_hdr, data)->refcount > 0)
Expand All @@ -601,8 +588,7 @@ void ipc_rcu_putref(void *ptr)
call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,
ipc_schedule_free);
} else {
call_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,
ipc_immediate_free);
kfree_rcu(container_of(ptr, struct ipc_rcu_grace, data), rcu);
}
}

Expand Down
8 changes: 1 addition & 7 deletions kernel/audit_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,10 @@ static inline void get_tree(struct audit_tree *tree)
atomic_inc(&tree->count);
}

static void __put_tree(struct rcu_head *rcu)
{
struct audit_tree *tree = container_of(rcu, struct audit_tree, head);
kfree(tree);
}

static inline void put_tree(struct audit_tree *tree)
{
if (atomic_dec_and_test(&tree->count))
call_rcu(&tree->head, __put_tree);
kfree_rcu(tree, head);
}

/* to avoid bringing the entire thing in audit.h */
Expand Down
11 changes: 3 additions & 8 deletions kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,16 +1590,11 @@ void sysctl_head_get(struct ctl_table_header *head)
spin_unlock(&sysctl_lock);
}

static void free_head(struct rcu_head *rcu)
{
kfree(container_of(rcu, struct ctl_table_header, rcu));
}

void sysctl_head_put(struct ctl_table_header *head)
{
spin_lock(&sysctl_lock);
if (!--head->count)
call_rcu(&head->rcu, free_head);
kfree_rcu(head, rcu);
spin_unlock(&sysctl_lock);
}

Expand Down Expand Up @@ -1971,10 +1966,10 @@ void unregister_sysctl_table(struct ctl_table_header * header)
start_unregistering(header);
if (!--header->parent->count) {
WARN_ON(1);
call_rcu(&header->parent->rcu, free_head);
kfree_rcu(header->parent, rcu);
}
if (!--header->count)
call_rcu(&header->rcu, free_head);
kfree_rcu(header, rcu);
spin_unlock(&sysctl_lock);
}

Expand Down
18 changes: 2 additions & 16 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,6 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
return ERR_PTR(-EBUSY);
}

static void rcu_free_va(struct rcu_head *head)
{
struct vmap_area *va = container_of(head, struct vmap_area, rcu_head);

kfree(va);
}

static void __free_vmap_area(struct vmap_area *va)
{
BUG_ON(RB_EMPTY_NODE(&va->rb_node));
Expand Down Expand Up @@ -491,7 +484,7 @@ static void __free_vmap_area(struct vmap_area *va)
if (va->va_end > VMALLOC_START && va->va_end <= VMALLOC_END)
vmap_area_pcpu_hole = max(vmap_area_pcpu_hole, va->va_end);

call_rcu(&va->rcu_head, rcu_free_va);
kfree_rcu(va, rcu_head);
}

/*
Expand Down Expand Up @@ -837,13 +830,6 @@ static struct vmap_block *new_vmap_block(gfp_t gfp_mask)
return vb;
}

static void rcu_free_vb(struct rcu_head *head)
{
struct vmap_block *vb = container_of(head, struct vmap_block, rcu_head);

kfree(vb);
}

static void free_vmap_block(struct vmap_block *vb)
{
struct vmap_block *tmp;
Expand All @@ -856,7 +842,7 @@ static void free_vmap_block(struct vmap_block *vb)
BUG_ON(tmp != vb);

free_vmap_area_noflush(vb->va);
call_rcu(&vb->rcu_head, rcu_free_vb);
kfree_rcu(vb, rcu_head);
}

static void purge_fragmented_blocks(int cpu)
Expand Down
8 changes: 1 addition & 7 deletions net/netfilter/xt_RATEEST.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ struct xt_rateest *xt_rateest_lookup(const char *name)
}
EXPORT_SYMBOL_GPL(xt_rateest_lookup);

static void xt_rateest_free_rcu(struct rcu_head *head)
{
kfree(container_of(head, struct xt_rateest, rcu));
}

void xt_rateest_put(struct xt_rateest *est)
{
mutex_lock(&xt_rateest_mutex);
Expand All @@ -75,7 +70,7 @@ void xt_rateest_put(struct xt_rateest *est)
* gen_estimator est_timer() might access est->lock or bstats,
* wait a RCU grace period before freeing 'est'
*/
call_rcu(&est->rcu, xt_rateest_free_rcu);
kfree_rcu(est, rcu);
}
mutex_unlock(&xt_rateest_mutex);
}
Expand Down Expand Up @@ -188,7 +183,6 @@ static int __init xt_rateest_tg_init(void)
static void __exit xt_rateest_tg_fini(void)
{
xt_unregister_target(&xt_rateest_tg_reg);
rcu_barrier(); /* Wait for completion of call_rcu()'s (xt_rateest_free_rcu) */
}


Expand Down
10 changes: 1 addition & 9 deletions security/device_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,6 @@ static int dev_whitelist_add(struct dev_cgroup *dev_cgroup,
return 0;
}

static void whitelist_item_free(struct rcu_head *rcu)
{
struct dev_whitelist_item *item;

item = container_of(rcu, struct dev_whitelist_item, rcu);
kfree(item);
}

/*
* called under devcgroup_mutex
*/
Expand All @@ -155,7 +147,7 @@ static void dev_whitelist_rm(struct dev_cgroup *dev_cgroup,
walk->access &= ~wh->access;
if (!walk->access) {
list_del_rcu(&walk->list);
call_rcu(&walk->rcu, whitelist_item_free);
kfree_rcu(walk, rcu);
}
}
}
Expand Down
20 changes: 2 additions & 18 deletions security/selinux/netnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,6 @@ static LIST_HEAD(sel_netnode_list);
static DEFINE_SPINLOCK(sel_netnode_lock);
static struct sel_netnode_bkt sel_netnode_hash[SEL_NETNODE_HASH_SIZE];

/**
* sel_netnode_free - Frees a node entry
* @p: the entry's RCU field
*
* Description:
* This function is designed to be used as a callback to the call_rcu()
* function so that memory allocated to a hash table node entry can be
* released safely.
*
*/
static void sel_netnode_free(struct rcu_head *p)
{
struct sel_netnode *node = container_of(p, struct sel_netnode, rcu);
kfree(node);
}

/**
* sel_netnode_hashfn_ipv4 - IPv4 hashing function for the node table
* @addr: IPv4 address
Expand Down Expand Up @@ -193,7 +177,7 @@ static void sel_netnode_insert(struct sel_netnode *node)
rcu_dereference(sel_netnode_hash[idx].list.prev),
struct sel_netnode, list);
list_del_rcu(&tail->list);
call_rcu(&tail->rcu, sel_netnode_free);
kfree_rcu(tail, rcu);
} else
sel_netnode_hash[idx].size++;
}
Expand Down Expand Up @@ -306,7 +290,7 @@ static void sel_netnode_flush(void)
list_for_each_entry_safe(node, node_tmp,
&sel_netnode_hash[idx].list, list) {
list_del_rcu(&node->list);
call_rcu(&node->rcu, sel_netnode_free);
kfree_rcu(node, rcu);
}
sel_netnode_hash[idx].size = 0;
}
Expand Down
Loading

0 comments on commit 0342cbc

Please sign in to comment.