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

Processor affinity is not re-entrant safe #780

Open
markbeierl opened this issue Mar 15, 2024 · 3 comments
Open

Processor affinity is not re-entrant safe #780

markbeierl opened this issue Mar 15, 2024 · 3 comments
Assignees

Comments

@markbeierl
Copy link
Contributor

The up4.bess script uses the utils.py to set processor affinity for all processes running on the system. An issue can arise if the script is run a second time, as the parent of whatever called the script has had its own affinity rules modified.

For example, given a CPU set of [0-7] cores, and I am in an interactive shell where I can execute bessctl.

On the first run, it gets the current process's affinity list: https://github.com/omec-project/upf/blob/master/conf/utils.py#L131 This would result in [0-7] cores being available.

It then uses that to carve out as many CPUs as workers needed. Given 1 worker, this means the CPU affinity set is [1-7]. It then sets that mask on every process, including itself.

On second run, when it asks for the current process's affinity list, it will receive [1-7], and will reduce that by one, leaving [2-7] as the new mask to set for every process it can.

@markbeierl
Copy link
Contributor Author

I believe a better approach would be to find full count of CPUs as the initial cores value, as this will be constant.

@gab-arrobo
Copy link
Collaborator

It would be great if you can provide a patch for your proposed solution

@markbeierl
Copy link
Contributor Author

Certainly, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants