Mercurial > illumos > illumos-gate
changeset 14175:15e9457c12ec
1974 pages_pp_maximum/lotsfree discrepancy leads to mlock() failure
Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com>
Reviewed by: Brendan Gregg <brendan.gregg@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
author | Bryan Cantrill <bryan@joyent.com> |
---|---|
date | Sat, 03 Aug 2013 16:27:57 -0700 |
parents | f63fe73094ce |
children | c584b682c5c8 |
files | usr/src/uts/common/fs/zfs/arc.c |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/arc.c Fri Aug 23 18:31:03 2013 -0400 +++ b/usr/src/uts/common/fs/zfs/arc.c Sat Aug 03 16:27:57 2013 -0700 @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -2235,6 +2236,16 @@ if (availrmem < swapfs_minfree + swapfs_reserve + extra) return (1); + /* + * Check that we have enough availrmem that memory locking (e.g., via + * mlock(3C) or memcntl(2)) can still succeed. (pages_pp_maximum + * stores the number of pages that cannot be locked; when availrmem + * drops below pages_pp_maximum, page locking mechanisms such as + * page_pp_lock() will fail.) + */ + if (availrmem <= pages_pp_maximum) + return (1); + #if defined(__i386) /* * If we're on an i386 platform, it's possible that we'll exhaust the