Skip to content

opcache posix creating special shared segments for FreeBSD 13 and above. #8037

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

Closed
wants to merge 1 commit into from

Conversation

devnexen
Copy link
Member

@devnexen devnexen commented Feb 4, 2022

From this release, it is permitted to create shared memory blocks tagged
as large for faster accesses for a size compatible with otherwise
we fallback to a classic creation.

@devnexen devnexen force-pushed the opcache_large_shm_posix branch from bd3b4d7 to b4e7420 Compare May 10, 2022 16:35
@devnexen devnexen marked this pull request as ready for review May 10, 2022 16:55
@ramsey ramsey added this to the PHP 8.2 milestone May 25, 2022
@adoy adoy removed this from the PHP 8.2 milestone Feb 16, 2023
Comment on lines 54 to 86
shared_segment->shm_fd = shm_open(shared_segment_name, O_RDWR|O_CREAT|O_TRUNC, 0600);
shared_segment->shm_fd =
#if defined(HAVE_SHM_CREATE_LARGEPAGE)
shared_segment_lg_index > 0 ?
shm_create_largepage(shared_segment_name, shared_segment_flags, shared_segment_lg_index, SHM_LARGEPAGE_ALLOC_DEFAULT, shared_segment_mode) :
#endif
shm_open(shared_segment_name, shared_segment_flags, shared_segment_mode);
Copy link
Member

Choose a reason for hiding this comment

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

May be it makes sense to fallback to shm_open if shm_create_largepage is failed?

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed

shared_segment_lg_index > 0 ?
shm_create_largepage(shared_segment_name, shared_segment_flags, shared_segment_lg_index, SHM_LARGEPAGE_ALLOC_DEFAULT, shared_segment_mode) :
#endif
shm_open(shared_segment_name, shared_segment_flags, shared_segment_mode);
if (shared_segment->shm_fd == -1) {
*error_in = "shm_open";
Copy link
Member

Choose a reason for hiding this comment

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

"shm_open" name may be wrong now.

Copy link
Member Author

Choose a reason for hiding this comment

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

if we do fallback from the large page flavor to the traditional shm_open it might not.

Copy link
Member

Choose a reason for hiding this comment

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

yes. but now you don't fallback.

Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

Sorry, it looks like I missed this PR.
Please fix the merge conflict and update according to comments.
Unfortunately, I can't test this but this shouldn't break anything unrelated.

From this release, it is permitted to create shared memory blocks tagged
 as large for faster accesses for a size compatible with otherwise
we fallback to a classic creation.
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

I can't test this. But the sources look good now.

@devnexen devnexen closed this in 2e0ca47 Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants