Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add agent exec pkg#15577

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sreya merged 17 commits intomainfromjon/agentexec
Nov 25, 2024
Merged

feat: add agent exec pkg#15577

sreya merged 17 commits intomainfromjon/agentexec
Nov 25, 2024

Conversation

sreya
Copy link
Collaborator

This PR adds anagentexec pkg with the intention of eventually replacing the current way we manage process priority in workspaces. The intent is for every invocation ofexec.Command() to be wrapped byagentexec.Command to ensure that we adjust the niceness and oom_score appropriately.

@sreyasreya marked this pull request as ready for reviewNovember 20, 2024 22:26
@sreya
Copy link
CollaboratorAuthor

@spikecurtis@deansheather should our inability to adjust scores for oom or niceness result in a fatal error? If you misconfigure the numbers you've effectively bricked your template.

@deansheather
Copy link
Member

I would say no

@sreyasreya merged commitbbc549d intomainNov 25, 2024
27 checks passed
@sreyasreya deleted the jon/agentexec branchNovember 25, 2024 15:22
@sreyasreya restored the jon/agentexec branchNovember 27, 2024 14:36
@sreyasreya deleted the jon/agentexec branchNovember 27, 2024 14:36
return 0, xerrors.Errorf("get nice score: %w", err)
}
// See https://linux.die.net/man/2/setpriority#Notes
score = 20 - score
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get why we're translating from kernel to userspace scores here if we just callSetpriority() with this value. Shouldn't we need to translate back?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Thegetpriorityman page says the following:

The getpriority system call returns nice values translated to the
range 40..1, since a negative return value would be interpreted
as an error. The glibc wrapper function for getpriority()
translates the value back according to the formula
unice = 20 - knice (thus, the 40..1 range returned by the kernel
corresponds to the range -20..19 as seen by user space).

Further up it says the following forsetpriority:

The prio argument is a value in the range -20 to 19 (but see
NOTES below), with -20 being the highest priority and 19 being
the lowest priority. Attempts to set a priority outside this
range are silently clamped to the range. The default priority is
0; lower values give a process a higher scheduling priority.

Pretty confusing tbh

Copy link
Contributor

Choose a reason for hiding this comment

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

Woof. OK, initially read this as glibc doing the translation in both cases, but I guess it's only the get operation that has issues with negative numbers.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@spikecurtisspikecurtisspikecurtis left review comments

@deansheatherdeansheatherdeansheather approved these changes

Assignees

@sreyasreya

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@sreya@deansheather@spikecurtis

[8]ページ先頭

©2009-2025 Movatter.jp