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

            "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56863
            Subject: LU-13805 tests: test 89
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: d58861410052ec06e7f97cac3237832164fe3ad8

            gerrit Gerrit Updater added a comment - "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56863 Subject: LU-13805 tests: test 89 Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: d58861410052ec06e7f97cac3237832164fe3ad8

            "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56862
            Subject: LU-13805 tests: update lseek test
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 33b8b99cf2b1b7f17fe0e944b87db8b59a8f64cc

            gerrit Gerrit Updater added a comment - "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56862 Subject: LU-13805 tests: update lseek test Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 33b8b99cf2b1b7f17fe0e944b87db8b59a8f64cc

            "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56855
            Subject: LU-13805 llite: enable hybrid IO by default
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: f464e1620305b1e36b8f7b4c3b81f870bb9b1544

            gerrit Gerrit Updater added a comment - "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56855 Subject: LU-13805 llite: enable hybrid IO by default Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: f464e1620305b1e36b8f7b4c3b81f870bb9b1544

            "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/55360
            Subject: LU-13805 llite: add ladvise to disable hybrid on a file
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 1f0fa1bba61742f058bc2eb85fca18c11c07731f

            gerrit Gerrit Updater added a comment - "Patrick Farrell <patrick.farrell@oracle.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/55360 Subject: LU-13805 llite: add ladvise to disable hybrid on a file Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 1f0fa1bba61742f058bc2eb85fca18c11c07731f

            "Oleg Drokin <green@whamcloud.com>" merged in 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:
            Commit: 7c98f16b91b5f34fcbdb98a37f0d8115e31a7297

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in 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: Commit: 7c98f16b91b5f34fcbdb98a37f0d8115e31a7297

            Yes, sure - I'll add those checks.

            paf0186 Patrick Farrell added a comment - Yes, sure - I'll add those checks.

            I opened LU-17473 to take these two patches, which aren't actually related to unaligned DIO:
            llite: wait for partially successful aio 
            https://review.whamcloud.com/50966/
            tests: add racing tests of aio 
            https://review.whamcloud.com/50577/

            paf0186 Patrick Farrell added a comment - I opened LU-17473 to take these two patches, which aren't actually related to unaligned DIO: llite: wait for partially successful aio  https://review.whamcloud.com/50966/ tests: add racing tests of aio  https://review.whamcloud.com/50577/

            Patrick, a number of subtests added as part of this series are failing during sanity interop testing - 119h, 119i,
            https://testing.whamcloud.com/test_sets/dc77145c-b7d3-4010-a7a2-f8435f9353ff

            Could you please push a patch for master to add a version check to those subtests with:

            Fixes: 7194eb6431 ("LU-13805 clio: bounce buffer for unaligned DIO")
            
            adilger Andreas Dilger added a comment - Patrick, a number of subtests added as part of this series are failing during sanity interop testing - 119h, 119i, https://testing.whamcloud.com/test_sets/dc77145c-b7d3-4010-a7a2-f8435f9353ff Could you please push a patch for master to add a version check to those subtests with: Fixes: 7194eb6431 ("LU-13805 clio: bounce buffer for unaligned DIO")

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51126/
            Subject: LU-13805 llite: Implement unaligned DIO connect flag
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 0e6e60b1233b08952c338b2c4f121ef749a99f8b

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51126/ Subject: LU-13805 llite: Implement unaligned DIO connect flag Project: fs/lustre-release Branch: master Current Patch Set: Commit: 0e6e60b1233b08952c338b2c4f121ef749a99f8b

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51125/
            Subject: LU-13805 llite: add flag to disable unaligned DIO
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 33ed79ba61a3275519c897557407619d576a9dc2

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51125/ Subject: LU-13805 llite: add flag to disable unaligned DIO Project: fs/lustre-release Branch: master Current Patch Set: Commit: 33ed79ba61a3275519c897557407619d576a9dc2

            People

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

              Dates

                Created:
                Updated: