From owner-p4-projects@FreeBSD.ORG Fri Jun 2 16:31:48 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A802316A4EB; Fri, 2 Jun 2006 16:31:46 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ECC9616A4D6 for ; Fri, 2 Jun 2006 16:31:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4B6243D73 for ; Fri, 2 Jun 2006 16:31:39 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k52GU8bC001624 for ; Fri, 2 Jun 2006 16:30:08 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k52GU8gN001621 for perforce@freebsd.org; Fri, 2 Jun 2006 16:30:08 GMT (envelope-from jhb@freebsd.org) Date: Fri, 2 Jun 2006 16:30:08 GMT Message-Id: <200606021630.k52GU8gN001621@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 98351 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jun 2006 16:31:53 -0000 http://perforce.freebsd.org/chv.cgi?CH=98351 Change 98351 by jhb@jhb_mutex on 2006/06/02 16:29:50 Move the vm.blacklist handling up a layer so that we only try to look up the tunable once during boot instead of once for every memory page in the system. This should make Kip happy. Affected files ... .. //depot/projects/smpng/sys/vm/vm_page.c#75 edit .. //depot/projects/smpng/sys/vm/vm_pageq.c#19 edit Differences ... ==== //depot/projects/smpng/sys/vm/vm_page.c#75 (text+ko) ==== @@ -158,6 +158,36 @@ } /* + * vm_page_blacklist_lookup: + * + * See if a physical address in this page has been listed + * in the blacklist tunable. Entries in the tunable are + * separated by spaces or commas. If an invalid integer is + * encountered then the rest of the string is skipped. + */ +static int +vm_page_blacklist_lookup(char *list, vm_paddr_t pa) +{ + vm_paddr_t bad; + char *cp, *pos; + + for (pos = list; *pos != '\0'; pos = cp) { + bad = strtoq(pos, &cp, 0); + if (*cp != '\0') { + if (*cp == ' ' || *cp == ',') { + cp++; + if (cp == pos) + continue; + } else + break; + } + if (pa == trunc_page(bad)) + return (1); + } + return (0); +} + +/* * vm_page_startup: * * Initializes the resident memory module. @@ -177,6 +207,7 @@ vm_paddr_t pa; int nblocks; vm_paddr_t last_pa; + char *list; /* the biggest memory array is the second group of pages */ vm_paddr_t end; @@ -293,14 +324,23 @@ */ cnt.v_page_count = 0; cnt.v_free_count = 0; + list = getenv("vm.blacklist"); for (i = 0; phys_avail[i + 1] && npages > 0; i += 2) { pa = phys_avail[i]; last_pa = phys_avail[i + 1]; while (pa < last_pa && npages-- > 0) { + if (list != NULL && + vm_page_blacklist_lookup(list, pa)) { + printf("Skipping page with pa 0x%jx\n", + (uintmax_t)pa); + + continue; + } vm_pageq_add_new_page(pa); pa += PAGE_SIZE; } } + freeenv(list); return (vaddr); } ==== //depot/projects/smpng/sys/vm/vm_pageq.c#19 (text+ko) ==== @@ -191,37 +191,7 @@ vm_page_t vm_pageq_add_new_page(vm_paddr_t pa) { - vm_paddr_t bad; vm_page_t m; - char *cp, *list, *pos; - - /* - * See if a physical address in this page has been listed - * in the blacklist tunable. Entries in the tunable are - * separated by spaces or commas. If an invalid integer is - * encountered then the rest of the string is skipped. - */ - if (testenv("vm.blacklist")) { - list = getenv("vm.blacklist"); - for (pos = list; *pos != '\0'; pos = cp) { - bad = strtoq(pos, &cp, 0); - if (*cp != '\0') { - if (*cp == ' ' || *cp == ',') { - cp++; - if (cp == pos) - continue; - } else - break; - } - if (pa == trunc_page(bad)) { - printf("Skipping page with pa 0x%jx\n", - (uintmax_t)pa); - freeenv(list); - return (NULL); - } - } - freeenv(list); - } atomic_add_int(&cnt.v_page_count, 1); m = PHYS_TO_VM_PAGE(pa);