- oom-kill-mm-locking-fix.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     oom-kill: mm locking fix

has been removed from the -mm tree.  Its filename is

     oom-kill-mm-locking-fix.patch

This patch was probably dropped from -mm because
it has now been merged into a subsystem tree or
into Linus's tree, or because it was folded into
its parent patch in the -mm tree.


From: Andrew Morton <akpm@xxxxxxxx>

Dave Peterson <dsp@xxxxxxxx> points out that badness() is playing with
mm_structs without taking a reference on them.

mmput() can sleep, so taking a reference here (inside tasklist_lock) is hard. 
Fix it up via task_lock() instead.

Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 mm/oom_kill.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff -puN mm/oom_kill.c~oom-kill-mm-locking-fix mm/oom_kill.c
--- devel/mm/oom_kill.c~oom-kill-mm-locking-fix	2006-04-18 22:19:58.000000000 -0700
+++ devel-akpm/mm/oom_kill.c	2006-04-18 22:19:58.000000000 -0700
@@ -46,15 +46,25 @@
 unsigned long badness(struct task_struct *p, unsigned long uptime)
 {
 	unsigned long points, cpu_time, run_time, s;
-	struct list_head *tsk;
+	struct mm_struct *mm;
+	struct task_struct *child;
 
-	if (!p->mm)
+	task_lock(p);
+	mm = p->mm;
+	if (!mm) {
+		task_unlock(p);
 		return 0;
+	}
 
 	/*
 	 * The memory size of the process is the basis for the badness.
 	 */
-	points = p->mm->total_vm;
+	points = mm->total_vm;
+
+	/*
+	 * After this unlock we can no longer dereference local variable `mm'
+	 */
+	task_unlock(p);
 
 	/*
 	 * Processes which fork a lot of child processes are likely
@@ -64,11 +74,11 @@ unsigned long badness(struct task_struct
 	 * child is eating the vast majority of memory, adding only half
 	 * to the parents will make the child our kill candidate of choice.
 	 */
-	list_for_each(tsk, &p->children) {
-		struct task_struct *chld;
-		chld = list_entry(tsk, struct task_struct, sibling);
-		if (chld->mm != p->mm && chld->mm)
-			points += chld->mm->total_vm/2 + 1;
+	list_for_each_entry(child, &p->children, sibling) {
+		task_lock(child);
+		if (child->mm != mm && child->mm)
+			points += child->mm->total_vm/2 + 1;
+		task_unlock(child);
 	}
 
 	/*
_

Patches currently in -mm which might be from akpm@xxxxxxxx are

origin.patch
config_net=n-build-fix.patch
git-acpi.patch
acpi-update-asus_acpi-driver-registration-fix.patch
acpi-memory-hotplug-cannot-manage-_crs-with-plural-resoureces.patch
catch-notification-of-memory-add-event-of-acpi-via-container-driver-register-start-func-for-memory-device.patch
catch-notification-of-memory-add-event-of-acpi-via-container-driveravoid-redundant-call-add_memory.patch
sony_apci-resume.patch
powernow-k8-crash-workaround.patch
git-dvb.patch
sparc32-vivi-fix.patch
git-dvb-compat-build-fix.patch
bt866-build-fix.patch
connector-exports.patch
git-libata-all.patch
git-mtd.patch
pci-error-recovery-e1000-network-device-driver.patch
gregkh-pci-pci-64-bit-resources-drivers-others-changes-amba-fix.patch
git-pcmcia.patch
git-scsi-misc.patch
git-scsi-misc-scsi_kmap_atomic_sg-warning-fix.patch
megaraid-unused-variable.patch
git-splice-smbfs-fixes.patch
git-watchdog.patch
arm-add_memory-build-fix.patch
pg_uncached-is-ia64-only.patch
migration-remove-unnecessary-pageswapcache-checks-fix.patch
wait_table-and-zonelist-initializing-for-memory-hotadd-wait_table-initialization-fixes.patch
preserve-write-permissions-in-migration-entries-fix.patch
slab-cleanup-kmem_getpages-fix.patch
slab-stop-using-list_for_each-fix.patch
acx1xx-wireless-driver.patch
prune_one_dentry-tweaks.patch
mmput-might-sleep.patch
tpm-use-clear_bit-fix.patch
tpm-use-clear_bit-fix-fix.patch
tpm-use-clear_bit-fix-fix-fix-fix.patch
hangcheck-remove-monotomic_clock-on-x86.patch
pi-futex-futex-code-cleanups-fix.patch
reiser4.patch
kgdb-core-lite-add-reboot-command.patch
kgdb-8250-fix.patch
nr_blockdev_pages-in_interrupt-warning.patch
device-suspend-debug.patch
revert-tty-buffering-comment-out-debug-code.patch
slab-leaks3-default-y.patch
x86-kmap_atomic-debugging.patch
sk_state_change-debug.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux