On Wed, Mar 26, 2008 at 3:29 AM, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:I'm not convinced of this. All we have to do is find some other process p where p->mm == current->mm and make it the new owner. Exactly what sequence of clone() calls was used to cause the sharing isn't really relevant. I really think that a suitable candidate will be found amongst your children or your first sibling in 99.9% of those cases where more than one process is using an mm. The actual sequence would have to go something like: static inline bool need_new_owner(struct mm_struct *mm) { return (mm && mm->owner == current && atomic_read(&mm->users) > 1); } static inline void try_give_mm_ownership( struct task_struct *task, struct mm_struct *mm) { if (task->mm != mm) return; task_lock(task); if (task->mm == mm) { mm->owner = task; } task_unlock(task); } struct mm_struct *mm = current->mm; task_lock(current); current->mm = NULL; task_unlock(current); /* First try my children */ if (need_new_owner(mm)) { for_each_child(current, c) { try_give_mm_ownership(c); if (!need_new_owner(mm)) break; } } /* Then try my siblings */ if (need_new_owner(mm)) { for_each_child(current->real_parent, c) { try_give_mm_ownership(c); if (!need_new_owner(mm)) break; } } if (need_new_owner(mm)) { /* We'll almost never get here */ for_each_process(p) { try_give_mm_ownership(p); if (!need_new_owner(mm)) break; } } Paul --
| Artem Bityutskiy | [PATCH 10/44 take 2] [UBI] debug unit implementation |
| Jeremy Fitzhardinge | [PATCH 03 of 36] x86: add memory barriers to wrmsr |
| Zachary Amsden | Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap paravirt ops callsites to ma... |
| Justin Mattock | macbook pro dvd playback after suspend Buffer I/O error |
git: | |
| David Kastrup | Empty directories... |
| Johannes Schindelin | Re: [PATCH 1/4] Move redo merge code in a function |
| Jeff King | Re: detecting rename->commit->modify->commit |
| Pierre Habouzit | Re: [RFC] git integrated bugtracking |
| David Higgs | Re: Using the C programming language |
| Chris Bullock | OpenBSD isakmpd and pf vs Cisco PIX or ASA |
| Richard Stallman | Real men don't attack straw men |
| Chris S | Re: No text cursor on OpenBSD/i386 4.1 |
| Jojie R. T. | Re: SLS |
| Peter MacDonald | demand paging: proposal |
| Theodore Ts'o | Re: Stabilizing Linux |
| Doug Evans | Re: Stabilizing Linux |
| Battery Maximizer Software | 8 hours ago | Linux kernel |
| windows folder creation surprise | 10 hours ago | Windows |
| Problem in scim in Fedora 9 | 11 hours ago | Linux general |
| Firewall | 1 day ago | OpenBSD |
| IP layer send packet | 1 day ago | Linux kernel |
| dtrace for linux available | 2 days ago | Linux kernel |
| Unable to mount ramdisk image using UBoot while upgrading to 2.6.15 kernel for a MPC8540 based target | 2 days ago | Linux kernel |
| RealTek RTL8169 - can't connect | 2 days ago | NetBSD |
| vsftpd Upload Problems | 2 days ago | Linux general |
| creating con folder in desktop | 3 days ago | Windows |
