On Sat, May 3, 2008 at 2:38 PM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:You need to synchronize against mm->owner changing, or mm->owner->cgroups changing. How about: int rlimit_cgroup_charge_as(struct mm_struct *mm, unsigned long nr_pages) { int ret; struct rlimit_cgroup *rcg; struct task_struct *owner; rcu_read_lock(); again: /* Find and lock the owner of the mm */ owner = rcu_dereference(mm->owner); task_lock(owner); if (mm->owner != owner) { task_unlock(owner); goto again; } /* Charge the owner's cgroup with the new memory */ rcg = rlimit_cgroup_from_task(owner); ret = res_counter_charge(&rcg->as_res, (nr_pages << PAGE_SHIFT)); task_unlock(owner); rcu_read_unlock(); return ret; } Can't this be implemented as just a call to charge() with a negative value? (Possibly fixing res_counter_charge() to handle negative values if necessary) Seems simpler. You mean disallow all movement within a hierarchy that has this cgroup mounted? Doesn't that make it rather hard to use? Since you need to protect against concurrent charges, and against concurrent mm ownership changes, I think you should just do this under task_lock(p). Also needs to task_lock(p) to prevent concurrent charges or cgroup reassignments? Paul --
| Artem Bityutskiy | [PATCH 00/22 take 3] UBI: Unsorted Block Images |
| Greg Kroah-Hartman | [PATCH 022/196] adb: Convert from class_device to device |
| Parag Warudkar | BUG: soft lockup - CPU#1 stuck for 15s! [swapper:0] |
| Ingo Molnar | Re: pthread_create() slow for many threads; also time to revisit 64b context switc... |
git: | |
| Bill Lear | Meaning of "fatal: protocol error: bad line length character"? |
| Ludovic | `git-send-email' doesn't specify `Content-Type' |
| Miles Bader | multiple-commit cherry-pick? |
| JD Guzman | C# Git Implementation |
| Martin Schröder | Re: Real men don't attack straw men |
| Jacob Meuser | Re: esd + mpd |
| Daniel Ouellet | identifying sparse files and get ride of them trick available? |
| Todd Pytel | IDE or SCSI virtual disks for VMWare image? |
| David Miller | Re: kernel oops when system under network stress |
| Denys Fedoryshchenko | thousands of classes, e1000 TX unit hang |
| Eric Dumazet | [PATCH 6/6] fs: Introduce kern_mount_special() to mount special vfs |
| Леонид Юрьев | [r8169] patch for RTL8102 (5 new MAC/PHY) |
