Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm uvm_anon_freelst:
details: https://anonhg.NetBSD.org/src/rev/5a97e9180ae7
branches: trunk
changeset: 768529:5a97e9180ae7
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Aug 18 14:13:02 2011 +0000
description:
uvm_anon_freelst:
- clear an_link/an_ref when deferring anon disposal. otherwise others can
see bogus an_ref.
- fix the code to remove anon from the list.
diffstat:
sys/uvm/uvm_anon.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diffs (49 lines):
diff -r 2dcee2df29a7 -r 5a97e9180ae7 sys/uvm/uvm_anon.c
--- a/sys/uvm/uvm_anon.c Thu Aug 18 13:47:22 2011 +0000
+++ b/sys/uvm/uvm_anon.c Thu Aug 18 14:13:02 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_anon.c,v 1.60 2011/08/14 01:20:33 rmind Exp $ */
+/* $NetBSD: uvm_anon.c,v 1.61 2011/08/18 14:13:02 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.60 2011/08/14 01:20:33 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.61 2011/08/18 14:13:02 yamt Exp $");
#include "opt_uvmhist.h"
@@ -214,22 +214,19 @@
void
uvm_anon_freelst(struct vm_amap *amap, struct vm_anon *anonlst)
{
- struct vm_anon *anon = anonlst, *prev = NULL, *next;
+ struct vm_anon *anon;
+ struct vm_anon **anonp = &anonlst;
KASSERT(mutex_owned(amap->am_lock));
-
- while (anon) {
- next = anon->an_link;
+ while ((anon = *anonp) != NULL) {
if (!uvm_anon_dispose(anon)) {
/* Do not free this anon. */
- if (prev) {
- prev->an_link = next;
- } else {
- anonlst = next;
- }
+ *anonp = anon->an_link;
+ /* Note: clears an_ref as well. */
+ anon->an_link = NULL;
+ } else {
+ anonp = &anon->an_link;
}
- prev = anon;
- anon = next;
}
amap_unlock(amap);
Home |
Main Index |
Thread Index |
Old Index