bug-hurd
[Top][All Lists]
Advanced

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

Bug#185094: Patch consider_lmm_collect: Test always true


From: John Tobey
Subject: Bug#185094: Patch consider_lmm_collect: Test always true
Date: Sun, 16 Mar 2003 19:39:16 -0500
User-agent: Mutt/1.3.28i

Package: gnumach
Version: CVS 20030316

In gnumach/oskit/osenv_mem.c, consider_lmm_collect() looks as if it
can stop short of transfering the optimal number of pages from VM to
LMM due to an oversight.  The variable `i' is decremented to 0 before
it is compared to `batch'.  Since `batch' is always positive there,
the test will always come out true, and the loop will exit too early.

The following patch should fix this.

-John

Index: oskit/osenv_mem.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/oskit/osenv_mem.c,v
retrieving revision 1.2
diff -u -r1.2 osenv_mem.c
--- oskit/osenv_mem.c   27 May 2002 23:01:57 -0000      1.2
+++ oskit/osenv_mem.c   16 Mar 2003 23:47:40 -0000
@@ -402,10 +402,11 @@
          unsigned int batch = need > PAGE_BATCH ? PAGE_BATCH : need;
          void *pages[PAGE_BATCH];
          unsigned int i;
+         vm_page_t mem = VM_PAGE_NULL;
 
          for (i = 0; i < batch; ++i)
            {
-             vm_page_t mem = vm_page_grab (FALSE);
+             mem = vm_page_grab (FALSE);
              if (mem == VM_PAGE_NULL)
                break;
              pages[i] = (void *) mem->phys_addr;
@@ -424,7 +425,7 @@
          simple_unlock (&phys_lmm_lock);
          splx (s);
 
-         if (i < batch)
+         if (mem == VM_PAGE_NULL)
            break;
          need -= batch;
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]