Comment 4 for bug 1718397

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification of this commit with the linux-hwe-edge kernel in -proposed,
using the attached test-case "io_setup_v2.c"

    commit 2a8a98673c13cb2a61a6476153acf8344adfa992
    Author: Mauricio Faria de Oliveira <email address hidden>
    Date: Wed Jul 5 10:53:16 2017 -0300

        fs: aio: fix the increment of aio-nr and counting against aio-max-nr

Test-case (attached)

    $ sudo apt-get install gcc libaio-dev
    $ gcc -o io_setup_v2 io_setup_v2.c -laio

Original kernel:

    - Only 409 io_contexts could be allocated,
    but that took 130880 [ div by 2, per bug] = 65440 slots out of 65535

    $ uname -rv
    4.11.0-14-generic #20~16.04.1-Ubuntu SMP Wed Aug 9 09:06:18 UTC 2017

    $ ./io_setup_v2 1 65536
    nr_events: 1, nr_requests: 65536
    rc = -11, i = 409
    ^Z
    [1]+ Stopped ./io_setup_v2 1 65536

    $ cat /proc/sys/fs/aio-nr
    130880

    $ cat /proc/sys/fs/aio-max-nr
    65536

    $ kill %%

Patched kernel:

    - Now 65515 io_contexts could be allocated out of 65535 (much better)
      (and reporting correctly, without div by 2.)

    $ uname -rv
    4.11.0-140-generic #20~16.04.1+bz146489 SMP Tue Sep 19 17:46:15 CDT 2017

    $ ./io_setup_v2 1 65536
    nr_events: 1, nr_requests: 65536
    rc = -12, i = 65515
    ^Z
    [1]+ Stopped ./io_setup_v2 1 65536

    $ cat /proc/sys/fs/aio-nr
    65515

    $ kill %%