Skip to content

Commit

Permalink
OS-2533 spawn fails occasionally with EAGAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
bcantrill committed Oct 17, 2013
1 parent 0d5f175 commit 6dc279d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 75 deletions.
4 changes: 0 additions & 4 deletions usr/src/uts/common/os/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,10 +940,6 @@ getproc(proc_t **cpp, pid_t pid, uint_t flags)
zone_t *zone;
int rctlfail = 0;

if (!page_mem_avail(tune.t_minarmem)) {
atomic_add_32(&curproc->p_zone->zone_ffnomem, 1);
return (-1);
}
if (zone_status_get(curproc->p_zone) >= ZONE_IS_SHUTTING_DOWN)
return (-1); /* no point in starting new processes */

Expand Down
1 change: 0 additions & 1 deletion usr/src/uts/common/vm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,6 @@ void page_retire_decr_pend_count(void *);
void page_clrtoxic(page_t *, uchar_t);
void page_settoxic(page_t *, uchar_t);

int page_mem_avail(pgcnt_t);
int page_reclaim_mem(pgcnt_t, pgcnt_t, int);

void page_set_props(page_t *, uint_t);
Expand Down
70 changes: 0 additions & 70 deletions usr/src/uts/common/vm/vm_page.c
Original file line number Diff line number Diff line change
Expand Up @@ -5698,76 +5698,6 @@ page_migrate(
}
}

ulong_t mem_waiters = 0;
ulong_t max_count = 20;
#define MAX_DELAY 0x1ff

/*
* Check if enough memory is available to proceed.
* Depending on system configuration and how much memory is
* reserved for swap we need to check against two variables.
* e.g. on systems with little physical swap availrmem can be
* more reliable indicator of how much memory is available.
* On systems with large phys swap freemem can be better indicator.
* If freemem drops below threshold level don't return an error
* immediately but wake up pageout to free memory and block.
* This is done number of times. If pageout is not able to free
* memory within certain time return an error.
* The same applies for availrmem but kmem_reap is used to
* free memory.
*/
int
page_mem_avail(pgcnt_t npages)
{
ulong_t count;

#if defined(__i386)
if (freemem > desfree + npages &&
availrmem > swapfs_reserve + npages &&
btop(vmem_size(heap_arena, VMEM_FREE)) > tune.t_minarmem +
npages)
return (1);
#else
if (freemem > desfree + npages &&
availrmem > swapfs_reserve + npages)
return (1);
#endif

count = max_count;
atomic_add_long(&mem_waiters, 1);

while (freemem < desfree + npages && --count) {
cv_signal(&proc_pageout->p_cv);
if (delay_sig(hz + (mem_waiters & MAX_DELAY))) {
atomic_add_long(&mem_waiters, -1);
return (0);
}
}
if (count == 0) {
atomic_add_long(&mem_waiters, -1);
return (0);
}

count = max_count;
while (availrmem < swapfs_reserve + npages && --count) {
kmem_reap();
if (delay_sig(hz + (mem_waiters & MAX_DELAY))) {
atomic_add_long(&mem_waiters, -1);
return (0);
}
}
atomic_add_long(&mem_waiters, -1);
if (count == 0)
return (0);

#if defined(__i386)
if (btop(vmem_size(heap_arena, VMEM_FREE)) <
tune.t_minarmem + npages)
return (0);
#endif
return (1);
}

#define MAX_CNT 60 /* max num of iterations */
/*
* Reclaim/reserve availrmem for npages.
Expand Down

0 comments on commit 6dc279d

Please sign in to comment.