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

Optimization of remote_function #846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apfeet
Copy link

@apfeet apfeet commented Apr 22, 2024

Description

I have made some changes to the remote_function to improve its readability and maintainability. Specifically, I have removed early returns and grouped the conditions into a single if.

Proposed Changes

Here is the optimized code:

static void remote_function(void *data)
{
	struct remote_function_call *tfc = data;
	struct task_struct *p = tfc->p;

	if (p && task_cpu(p) == smp_processor_id() && p == current) {
		tfc->ret = tfc->func(tfc->info);
	} else {
		tfc->ret = -ESRCH; /* No such (running) process */
	}
}

These changes make the code more readable and concise, facilitating future maintenance.

I hope these changes are beneficial and look forward to your feedback.

@rruuaanng
Copy link

hello apfeet

this repository is only read

please use git email commit patch

@apfeet
Copy link
Author

apfeet commented Apr 24, 2024

alr, thank u

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

Successfully merging this pull request may close these issues.

2 participants