Skip to content

Commit

Permalink
aio: double aio_max_nr in calculations
Browse files Browse the repository at this point in the history
With the changes to use percpu counters for aio event ring size calculation,
existing increases to aio_max_nr are now insufficient to allow for the
allocation of enough events.  Double the value used for aio_max_nr to account
for the doubling introduced by the percpu slack.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
  • Loading branch information
Benjamin LaHaise committed Jul 30, 2013
1 parent d29c445 commit 4cd81c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
return ERR_PTR(-EINVAL);
}

if (!nr_events || (unsigned long)nr_events > aio_max_nr)
if (!nr_events || (unsigned long)nr_events > (aio_max_nr * 2UL))
return ERR_PTR(-EAGAIN);

ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);
Expand Down Expand Up @@ -522,7 +522,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)

/* limit the number of system wide aios */
spin_lock(&aio_nr_lock);
if (aio_nr + nr_events > aio_max_nr ||
if (aio_nr + nr_events > (aio_max_nr * 2UL) ||
aio_nr + nr_events < aio_nr) {
spin_unlock(&aio_nr_lock);
goto out_cleanup;
Expand Down

0 comments on commit 4cd81c3

Please sign in to comment.