Skip to content

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

@torvalds torvalds closed this Sep 22, 2025
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.

3 participants