Skip to content

[GLUTEN-13062][VL] Clamp madvise(MADV_WILLNEED) length against posFetch_ to avoid EINVAL in MmapFileStream - #13063

Open
jiangjiangtian wants to merge 1 commit into
apache:mainfrom
jiangjiangtian:fix_madvise
Open

jiangjiangtian wants to merge 1 commit into
apache:mainfrom
jiangjiangtian:fix_madvise

Conversation

@jiangjiangtian

Copy link
Copy Markdown
Contributor

Closes #13062.
The fetch starts at posFetch_, so clamp the fetch length against size_ - posFetch_ instead of size_ - pos_. This keeps posFetch_ either page-aligned or exactly at size_ (after which no further fetch is needed), so every madvise() call receives a page-aligned address and no advised range overruns the mapping.
Besides, after this PR the prefetching will work in all cases, there is a perfermance gain in merging spills of shuffle data.

@github-actions github-actions Bot added the VELOX label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VL] madvise(WILLNEED) call fails in MmapFileStream because of wrong calculation of fetching length

1 participant