bug-hurd
[Top][All Lists]
Advanced

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

Oskit Mach: [patch] consider_lmm_collect: Test always true


From: Guillem Jover
Subject: Oskit Mach: [patch] consider_lmm_collect: Test always true
Date: Sat, 14 May 2005 20:14:52 +0300
User-agent: Mutt/1.5.9i

[ I've CCed John Tobey as I'm not sure if he has assigned the
  copyright. ]

Hi,

Long time ago we got a bug report in Debian with a patch for Oskit
Mach. Here it is:


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.


2005-05-14  John Tobey  <jtobey@john-edwin-tobey.org>

        * oskit/osenv_mem.c (consider_lmm_collect): Fix loop exit
        condition.


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]