lkml.org 
[lkml]   [2009]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 06/20] blkio: Introduce cgroup interface
Date
Vivek Goyal <vgoyal@redhat.com> writes:

> +void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
> + struct blkio_group *blkg, void *key)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(&blkcg->lock, flags);
> + rcu_assign_pointer(blkg->key, key);
> + hlist_add_head_rcu(&blkg->blkcg_node, &blkcg->blkg_list);
> + spin_unlock_irqrestore(&blkcg->lock, flags);
> +}

I took a look at the rcu stuff, and it seems to be in order.

> +/*
> + * We cannot support shared io contexts, as we have no mean to support
> + * two tasks with the same ioc in two different groups without major rework
> + * of the main cic data structures. For now we allow a task to change
> + * its cgroup only if it's the only owner of its ioc.
> + */

Interesting. So is there no way at all to set the cgroup for a set of
processes that are cloned using CLONE_IO?

> +static int blkiocg_can_attach(struct cgroup_subsys *subsys,
> + struct cgroup *cgroup, struct task_struct *tsk,
> + bool threadgroup)
> +{
> + struct io_context *ioc;
> + int ret = 0;
> +
> + /* task_lock() is needed to avoid races with exit_io_context() */
> + task_lock(tsk);
> + ioc = tsk->io_context;
> + if (ioc && atomic_read(&ioc->nr_tasks) > 1)
> + ret = -EINVAL;
> + task_unlock(tsk);
> +
> + return ret;
> +}

This function's name implies that it returns a boolean.

Cheers,
Jeff


\
 
 \ /
  Last update: 2009-11-04 16:27    [W:0.252 / U:32.740 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site