Date: Sun, 11 Nov 2001 01:39:48 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: David Xu <bsddiy@yahoo.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Found some unnecessary code Message-ID: <200111110939.fAB9dmU45444@apollo.backplane.com> References: <20011111075324.72482.qmail@web20906.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
:Found some unnecessary code in FreeBSD 4.4-stable VM. : :File vm_page.c, in function vm_page_startup(), vm_page :bucket is :zeroed two times, this is unnecessary. : :--- vm_page.c Sun Nov 11 15:34:41 2001 :+++ vm_page.c.orig Sun Nov 11 15:34:21 2001 :@@ -265,6 +265,11 @@ : vaddr = round_page(vaddr); : bzero((caddr_t) mapped, vaddr - mapped); : :+ for (i = 0; i < vm_page_bucket_count; i++) { :+ *bucket = NULL; :+ bucket++; :+ } :+ Hmm. That code has been through a lot. The buckets were originally a doubly-linked list requiring initialization, but I turned them into a singly-linked list in early 1999. It's somewhat of a fluke that the bzero even covers the proper area, because 'mapped' just happens to be equal to 'vaddr' due to the fact that vaddr has already been rounded up. But it isn't explicit. We could probably cleanup the code but we'd have to make the mapped/vaddr matchup explicit to really be able to depend on the bzero() (or some programmer might come along later and break it). : * Compute the number of pages of memory that will :be available for : * use (taking into account the overhead of a page :structure per : : : :File vm_object.c, function vm_object_backing_scan() :calling :vm_page_deactivate() is unnecessary, this is already :done in :vm_page_rename(). : : :--- vm_object.c.orig Sun Nov 11 15:35:22 2001 :+++ vm_object.c Sun Nov 11 15:35:42 2001 :@@ -1159,9 +1159,6 @@ : * If the page was mapped to a process, it can :remain : * mapped through the rename. : */ :- if ((p->queue - p->pc) == PQ_CACHE) :- vm_page_deactivate(p); :- : vm_page_rename(p, object, new_pindex); : /* page automatically made dirty by rename */ : } : :-- :David Xu This looks reasonable. This is also left-over cruft from older versions of the code. A bunch of stuff was collapsed into vm_page_rename(). -Matt Matthew Dillon <dillon@backplane.com> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111110939.fAB9dmU45444>