Reviewed by: "John S. Dyson" <dyson@iquest.net>

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
To prevent a deadlock, if we are extremely low on memory, force synchronous
operation by the VOP_PUTPAGES in vnode_pager_putpages.
This commit is contained in:
Alan Cox 1999-02-27 23:39:28 +00:00
parent f627793d19
commit 0e3cdf2cf8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44321

View File

@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
* $Id: vnode_pager.c,v 1.102 1999/01/21 08:29:12 dillon Exp $
* $Id: vnode_pager.c,v 1.103 1999/01/24 02:32:15 dillon Exp $
*/
/*
@ -833,6 +833,25 @@ vnode_pager_putpages(object, m, count, sync, rtvals)
struct vnode *vp;
int bytes = count * PAGE_SIZE;
/*
* Force synchronous operation if we are extremely low on memory
* to prevent a low-memory deadlock. VOP operations often need to
* allocate more memory to initiate the I/O ( i.e. do a BMAP
* operation ). The swapper handles the case by limiting the amount
* of asynchronous I/O, but that sort of solution doesn't scale well
* for the vnode pager without a lot of work.
*
* Also, the backing vnode's iodone routine may not wake the pageout
* daemon up. This should be probably be addressed XXX.
*/
if ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_pageout_free_min)
sync |= OBJPC_SYNC;
/*
* Call device-specific putpages function
*/
vp = object->handle;
rtval = VOP_PUTPAGES(vp, m, bytes, sync, rtvals, 0);
if (rtval == EOPNOTSUPP) {