Skip to content
  • Darrick J. Wong's avatar
    6d6ccedd
    xfs: only allocate memory for scrubbing attributes when we need it · 6d6ccedd
    Darrick J. Wong authored
    
    
    In examining a flame graph of time spent running xfs_scrub on various
    filesystems, I noticed that we spent nearly 7% of the total runtime on
    allocating a zeroed 65k buffer for every SCRUB_TYPE_XATTR invocation.
    We do this even if none of the attribute values were anywhere near 64k
    in size, even if there were no attribute blocks to check space on, and
    even if it just turns out there are no attributes at all.
    
    Therefore, rearrange the xattr buffer setup code to support reallocating
    with a bigger buffer and redistribute the callers of that function so
    that we only allocate memory just prior to needing it, and only allocate
    as much as we need.  If we can't get memory with the ILOCK held we'll
    bail out with EDEADLOCK which will allocate the maximum memory.
    
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
    6d6ccedd
    xfs: only allocate memory for scrubbing attributes when we need it
    Darrick J. Wong authored
    
    
    In examining a flame graph of time spent running xfs_scrub on various
    filesystems, I noticed that we spent nearly 7% of the total runtime on
    allocating a zeroed 65k buffer for every SCRUB_TYPE_XATTR invocation.
    We do this even if none of the attribute values were anywhere near 64k
    in size, even if there were no attribute blocks to check space on, and
    even if it just turns out there are no attributes at all.
    
    Therefore, rearrange the xattr buffer setup code to support reallocating
    with a bigger buffer and redistribute the callers of that function so
    that we only allocate memory just prior to needing it, and only allocate
    as much as we need.  If we can't get memory with the ILOCK held we'll
    bail out with EDEADLOCK which will allocate the maximum memory.
    
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Loading