Source-Changes-D archive

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

Re: CVS commit: [matt-nb5-mips64] src/sys/uvm



> >> To generate a diff of this commit:
> >> cvs rdiff -u -r1.42 -r1.42.16.1 src/sys/uvm/uvm_pglist.c
> >
> >>               /*
> >>                * Test both the ending and starting pages to see if =
> they are
> >>                * both free.  If the ending and starting pages are =
> same page,
> >>                * we only test one of them.  If the pages aren't free, =
> there
> >>                * is no reason to continue this iteration so advance =
> to the
> >>                * next address and try again.
> >>                */
> >>               if (VM_PAGE_IS_FREE(&pgs[end - 1]) == 0
> >>                   || end - 1 == tryidx + skip
> >>                   || VM_PAGE_IS_FREE(&pgs[tryidx + skip]) == 0) {
> >>                       try += roundup(num, align);
> >>                       skip = 0;
> >>                       continue;
> >>               }
> >
> > I guess this part can be improved and/or fixed as below.
> 
> I initially did something like that but realized it didn't really buy me
> anything since the compiler will actually do something like that
> anyways.

Ah, you're missing my point.  Let me rephrase again.

1) If `VM_PAGE_IS_FREE(&pgs[end - 1]) == 0' is false and `end - 1 ==
   tryidx + skip' is true, above code skips the region but actually we
   found the enough space.

2) If `VM_PAGE_IS_FREE(&pgs[end - 1]) == 0' is false and `end - 1 ==
   tryidx + skip' is false but `VM_PAGE_IS_FREE(&pgs[tryidx + skip])
   == 0' is true, it is better to advance the `try' by roundup(skip +
   1, align) instead of roundup(num, align).

enami.


Home | Main Index | Thread Index | Old Index