diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-09-08 11:32:49 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2016-09-08 11:32:49 +0000 |
commit | 049638cafafbc0458ea896cc257b5c0deb0c4206 (patch) | |
tree | bfc7f9e11cad510a7f01532dfe52c3b5fd60e9e1 | |
parent | 0c328f3385822b5508f3161cb022c8db22577b12 (diff) | |
parent | 9424a8dfe0a200274497dbfbbc8d8e53bfc38ac7 (diff) | |
download | illumos-joyent-049638cafafbc0458ea896cc257b5c0deb0c4206.tar.gz |
[illumos-gate merge]
commit 9424a8dfe0a200274497dbfbbc8d8e53bfc38ac7
7241 page_reclaim_mem() gives up on reclaiming memory too easily
commit c985e172447301fefddd2d30ac4cb0cac2281d0c
7359 NULL pointer at strcmp() in ipmgmt_nvlist_match()
-rw-r--r-- | usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_persist.c | 10 | ||||
-rw-r--r-- | usr/src/uts/common/vm/vm_page.c | 22 |
2 files changed, 22 insertions, 10 deletions
diff --git a/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_persist.c b/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_persist.c index 5c5057a172..8718abae3e 100644 --- a/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_persist.c +++ b/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_persist.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015 Joyent, Inc. + * Copyright 2016 Argo Technologie SA. */ /* @@ -112,19 +113,22 @@ ipmgmt_nvlist_match(nvlist_t *db_nvl, const char *proto, const char *ifname, if ((proto == NULL && db_proto != NULL) || (proto != NULL && db_proto == NULL) || - strcmp(proto, db_proto) != 0) { + (proto != NULL && db_proto != NULL && + strcmp(proto, db_proto) != 0)) { /* no intersection - different protocols. */ return (B_FALSE); } if ((ifname == NULL && db_ifname != NULL) || (ifname != NULL && db_ifname == NULL) || - strcmp(ifname, db_ifname) != 0) { + (ifname != NULL && db_ifname != NULL && + strcmp(ifname, db_ifname) != 0)) { /* no intersection - different interfaces. */ return (B_FALSE); } if ((aobjname == NULL && db_aobjname != NULL) || (aobjname != NULL && db_aobjname == NULL) || - strcmp(aobjname, db_aobjname) != 0) { + (aobjname != NULL && db_aobjname != NULL && + strcmp(aobjname, db_aobjname) != 0)) { /* no intersection - different address objects */ return (B_FALSE); } diff --git a/usr/src/uts/common/vm/vm_page.c b/usr/src/uts/common/vm/vm_page.c index 73833c669b..dec145e446 100644 --- a/usr/src/uts/common/vm/vm_page.c +++ b/usr/src/uts/common/vm/vm_page.c @@ -21,6 +21,7 @@ /* * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2015 by Delphix. All rights reserved. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -342,7 +343,6 @@ static void page_demote_vp_pages(page_t *); void pcf_init(void) - { if (boot_ncpus != -1) { pcf_fanout = boot_ncpus; @@ -5685,7 +5685,8 @@ next: } } -#define MAX_CNT 60 /* max num of iterations */ +uint_t page_reclaim_maxcnt = 60; /* max total iterations */ +uint_t page_reclaim_nofree_maxcnt = 3; /* max iterations without progress */ /* * Reclaim/reserve availrmem for npages. * If there is not enough memory start reaping seg, kmem caches. @@ -5701,15 +5702,22 @@ int page_reclaim_mem(pgcnt_t npages, pgcnt_t epages, int adjust) { int i = 0; + int i_nofree = 0; int ret = 0; pgcnt_t deficit; - pgcnt_t old_availrmem; + pgcnt_t old_availrmem = 0; mutex_enter(&freemem_lock); - old_availrmem = availrmem - 1; - while ((availrmem < tune.t_minarmem + npages + epages) && - (old_availrmem < availrmem) && (i++ < MAX_CNT)) { - old_availrmem = availrmem; + while (availrmem < tune.t_minarmem + npages + epages && + i++ < page_reclaim_maxcnt) { + /* ensure we made some progress in the last few iterations */ + if (old_availrmem < availrmem) { + old_availrmem = availrmem; + i_nofree = 0; + } else if (i_nofree++ >= page_reclaim_nofree_maxcnt) { + break; + } + deficit = tune.t_minarmem + npages + epages - availrmem; mutex_exit(&freemem_lock); page_needfree(deficit); |