Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • 9223372036854775807

    Description

      With the DIO performance improvements in LU-13798 and LU-13799, it becomes interesting to do larger buffered i/o (BIO) using the DIO path, as in LU-13802.

      LU-13802 covers the code for switching between the BIO and DIO paths, allowing BIO which meets the requirements for DIO to use the BIO path when appropriate.

      The problem is, the requirements for DIO are sometimes hard to meet.  i/o must be both page & size aligned.  This ticket is about how to do unaligned DIO, in order to let us do any BIO through the DIO path.

       

      This cannot be done with the existing Lustre i/o path.  There are a few minor issues, but the central problem is that if an i/o is unaligned, we no longer have a 1-to-1 mapping between a page on the client and a page in the file/on the server.  (Buffered i/o creates this 1-to-1 mapping by copying in to an aligned buffer.)  This 1-to-1 mapping could possibly be removed, but it would require a significant rework of the Lustre i/o path to make this possible.

      So, one option is creating a new DIO path which permits unaligned i/o from userspace all the way to disk.

      The other option comes from the following observation:
      When doing buffered i/o, about 20% of the time is spent in allocating the buffer and doing memcopy() in to that buffer.  Of the remaining 80%, something like 70% is page tracking of various kinds.
      Because each page in the page cache can be accessed from multiple threads, including being flushed at any time from various threads (memory pressure va kswapd, lock cancellation, writeout...), it has to be on various lists & have references on (effectively) the file it is part of, etc.

      This work, not allocation and memcopy, is where most of the time goes.

      So if we implement a simple buffering scheme - allocate an aligned buffer, then copy data to (or from) that buffer - and then do a normal DIO write(/read) from(/to) that buffer, this can be hugely faster than buffered i/o.

      If we use the normal DIO path (ie, sync write, and do not keep pages after read), we keep this as a buffer, and not a cache, so we can keep the DIO path lockless.

      Also, if we implement this correctly, we have a number of excellent options for speeding this up:

      1. Move allocation (if we're not pre-allocated) and memcopy from the user thread to the ptlrpcd threads handling RPC submission - This allows us to do these operations in parallel, which should dramatically improve speed.
      2. Use pre-allocated buffers.
      3. Potentially, since we control the entire copying path, we could enable the FPU to use vectorized memcopies.  (Various aspects of the buffered i/o path in the kernel mean the FPU has to be turned on and off for each page.  The cost of this outweighs the benefit of vectorized memcopy.)

      Attachments

        Issue Links

          Activity

            [LU-13805] i/o path: Unaligned direct i/o

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49991/
            Subject: LU-13805 clio: Add write to sdio
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 89f489ef9a18b5fea0571e2606dfdf064777626b

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49991/ Subject: LU-13805 clio: Add write to sdio Project: fs/lustre-release Branch: master Current Patch Set: Commit: 89f489ef9a18b5fea0571e2606dfdf064777626b

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/50529/
            Subject: LU-13805 tests: Add racing tests of BIO, DIO
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 43c3a804fe23c96de4f76ae9f1f8ba909558433d

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/50529/ Subject: LU-13805 tests: Add racing tests of BIO, DIO Project: fs/lustre-release Branch: master Current Patch Set: Commit: 43c3a804fe23c96de4f76ae9f1f8ba909558433d

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52057
            Subject: LU-13805 llite: make page_list_

            {add,del}

            symmetric
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 7c5eb60a6c9260b3816c760e449c7f14a35ef688

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52057 Subject: LU-13805 llite: make page_list_ {add,del} symmetric Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 7c5eb60a6c9260b3816c760e449c7f14a35ef688

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52050
            Subject: LU-13805 tests: janitor testing for csi_complete (8)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 8a5804fcc69fbd34a6b9e92e8287cdbcf004ed94

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52050 Subject: LU-13805 tests: janitor testing for csi_complete (8) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 8a5804fcc69fbd34a6b9e92e8287cdbcf004ed94

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52049
            Subject: LU-13805 tests: janitor testing for csi_complete (7)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 268a58e8485a51569ea3faef8ef4b1f2826096f0

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52049 Subject: LU-13805 tests: janitor testing for csi_complete (7) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 268a58e8485a51569ea3faef8ef4b1f2826096f0

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52048
            Subject: LU-13805 tests: janitor testing for csi_complete (6)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 3cd760fe020f0ce001bdadfea4a5c04eaeb474ca

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52048 Subject: LU-13805 tests: janitor testing for csi_complete (6) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 3cd760fe020f0ce001bdadfea4a5c04eaeb474ca

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52047
            Subject: LU-13805 tests: janitor testing for csi_complete (5)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 5d7cb36db4692d80b785b53c4bb72e3de891c583

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52047 Subject: LU-13805 tests: janitor testing for csi_complete (5) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 5d7cb36db4692d80b785b53c4bb72e3de891c583

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52046
            Subject: LU-13805 tests: janitor testing for csi_complete (4)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: b42a70c79b8e343f2af830bc6b5d0b770f8f0453

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52046 Subject: LU-13805 tests: janitor testing for csi_complete (4) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: b42a70c79b8e343f2af830bc6b5d0b770f8f0453

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52045
            Subject: LU-13805 tests: janitor testing for csi_complete (3)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: b5da30c10e4625e333f146a0bcca62a31ff402bd

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52045 Subject: LU-13805 tests: janitor testing for csi_complete (3) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: b5da30c10e4625e333f146a0bcca62a31ff402bd

            "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52044
            Subject: LU-13805 tests: janitor testing for csi_complete (2)
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 722198b9e8fae940b253f9beba612b682fb6b3b0

            gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/52044 Subject: LU-13805 tests: janitor testing for csi_complete (2) Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 722198b9e8fae940b253f9beba612b682fb6b3b0

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49990/
            Subject: LU-13805 tests: add unaligned io to multiop
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 84376bf67446d7b061d032719f335edc12a932ff

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49990/ Subject: LU-13805 tests: add unaligned io to multiop Project: fs/lustre-release Branch: master Current Patch Set: Commit: 84376bf67446d7b061d032719f335edc12a932ff

            People

              paf Patrick Farrell (Inactive)
              paf0186 Patrick Farrell
              Votes:
              0 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

                Created:
                Updated: