Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guarantee PAGESIZE alignment for large zio buffers #6084

Merged
merged 1 commit into from
May 2, 2017

Conversation

jxiong
Copy link
Contributor

@jxiong jxiong commented May 1, 2017

In current implementation, only zio buffers in 16KB and bigger are
guaranteed PAGESIZE alignment. This breaks Lustre since it assumes
that 'arc_buf_t::b_data' must be page aligned when zio buffers are
greater than or equal to PAGESIZE.

This patch will make the zio buffers to be PAGESIZE aligned when
the sizes are not less than PAGESIZE.

This change may cause a little bit memory waste but that should be
fine because after ABD is introduced, zio buffers are used to hold
data temporarily and live in memory for a short while.

Signed-off-by: Jinshan Xiong jinshan.xiong@gmail.com
Signed-off-by: Jinshan Xiong jinshan.xiong@intel.com

Description

Motivation and Context

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

In current implementation, only zio buffers in 16KB and bigger are
guaranteed PAGESIZE alignment. This breaks Lustre since it assumes
that 'arc_buf_t::b_data' must be page aligned when zio buffers are
greater than or equal to PAGESIZE.

This patch will make the zio buffers to be PAGESIZE aligned when
the sizes are not less than PAGESIZE.

This change may cause a little bit memory waste but that should be
fine because after ABD is introduced, zio buffers are used to hold
data temporarily and live in memory for a short while.

Signed-off-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
@mention-bot
Copy link

@jxiong, thanks for your PR! By analyzing the history of the files in this pull request, we identified @behlendorf, @don-brady and @dpquigl to be potential reviewers.

Copy link
Contributor

@don-brady don-brady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@behlendorf
Copy link
Contributor

@jxiong nice find. You may want to add some alignment assertions on the Lustre side to make sure we quickly catch any potential future changes in the area.

@jxiong
Copy link
Contributor Author

jxiong commented May 1, 2017

@behlendorf yes I already did it. Thanks for reminding.

@@ -167,10 +167,10 @@ zio_init(void)
*/
align = 8 * SPA_MINBLOCKSIZE;
#else
if (size <= 4 * SPA_MINBLOCKSIZE) {
if (size < PAGESIZE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in 3 additional caches being created for tiny buffers. That's not a problem and likely desirable but worth mentioning.

@behlendorf behlendorf merged commit 24fa203 into openzfs:master May 2, 2017
@jxiong jxiong deleted the zio_buf_alignment branch May 3, 2017 05:10
@adilger
Copy link
Contributor

adilger commented May 5, 2017

Will this fix be cherry-picked into the 0.6.5 branch?

@behlendorf
Copy link
Contributor

@adilger it's small enough I wouldn't object to cherry-picking it if you need it.

@adilger
Copy link
Contributor

adilger commented May 5, 2017

We're looking at how to handle this in Lustre, and without this fix it adds a constant (additional) memcpy() overhead for accessing small files. IMHO, it is preferable to backport this fix to 0.6.5 and just align the allocation correctly in the first place. That also avoids potential corruption for anyone using Lustre+ZFS 0.6.5.x without the Lustre-side fix.

@behlendorf
Copy link
Contributor

I've added to the list of patched to check pick for 0.6.5.10

rread pushed a commit to rread/lustre that referenced this pull request May 16, 2017
ZFS only guarantees PAGE_SIZE alignment to arc_buf_t only when
the block size is not less than (PAGE_SIZE << 2).

The patch for ZFS openzfs/zfs#6084 fixes
the alignment problem, buf Lustre still needs a fix to handle
the problem in case it's running old ZFS release.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I6fd17d7b20499ec0406a3e10cebf6882b92a730f
Reviewed-on: https://review.whamcloud.com/26895
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request May 25, 2017
In current implementation, only zio buffers in 16KB and bigger are
guaranteed PAGESIZE alignment. This breaks Lustre since it assumes
that 'arc_buf_t::b_data' must be page aligned when zio buffers are
greater than or equal to PAGESIZE.

This patch will make the zio buffers to be PAGESIZE aligned when
the sizes are not less than PAGESIZE.

This change may cause a little bit memory waste but that should be
fine because after ABD is introduced, zio buffers are used to hold
data temporarily and live in memory for a short while.

Reviewed-by: Don Brady <don.brady@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Closes openzfs#6084
tonyhutter pushed a commit that referenced this pull request Jun 9, 2017
In current implementation, only zio buffers in 16KB and bigger are
guaranteed PAGESIZE alignment. This breaks Lustre since it assumes
that 'arc_buf_t::b_data' must be page aligned when zio buffers are
greater than or equal to PAGESIZE.

This patch will make the zio buffers to be PAGESIZE aligned when
the sizes are not less than PAGESIZE.

This change may cause a little bit memory waste but that should be
fine because after ABD is introduced, zio buffers are used to hold
data temporarily and live in memory for a short while.

Reviewed-by: Don Brady <don.brady@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Closes #6084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants