-
Notifications
You must be signed in to change notification settings - Fork 591
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
Remove config dependency to fix ps command issue #6634
base: master
Are you sure you want to change the base?
Conversation
Due to config dependency, ps command doesn't give correct output. So, this patch fix the issue by removing config dependency for CONFIG_SMP and CONFIG_SMP_NCPUS. Signed-off-by: neel-samsung <[email protected]>
Due to config dependency, ps command doesn't give correct output. So, this patch fix the issue by removing config dependency for CONFIG_SMP and CONFIG_SMP_NCPUS between Kernel and application. We hande it by introducing the syscall for obtaining the number CPUs while runtime. Signed-off-by: neel-samsung <[email protected]>
65b699c
to
c1afe15
Compare
|
||
int sched_getcpucount(void) | ||
{ | ||
return CONFIG_SMP_NCPUS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if this value is not present?
I think we need to define values for when config is not existing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like
#if defined(CONFIG_SMP_NCPUS)
return CONFIG_SMP_NCPUS;
#else
return 0
or
In the file,
#if defined(CONFIG_SMP_NCPUS)
#define NCPUS CONFIG_SMP_NCPUS
#else
#define NCPUS 0
...
in sched_getcpucount()
return NCPUS;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are already defining the config if it is not present.
Lines 302 to 304 in e28022b
printf("#ifndef CONFIG_SMP_NCPUS\n"); | |
printf("# define CONFIG_SMP_NCPUS 1\n"); | |
printf("#endif\n\n"); |
@@ -179,32 +177,24 @@ static void cpuload_print_pid_value(char *buf, void *arg) | |||
} else { | |||
#ifdef CONFIG_SCHED_MULTI_CPULOAD | |||
for (i = PROC_STAT_CPULOAD_SHORT; i <= PROC_STAT_CPULOAD_LONG; i++) { | |||
#ifdef CONFIG_SMP | |||
char * avgload[CONFIG_SMP_NCPUS + 1]; | |||
char * avgload[ncpus + 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ncpus
is not static value. you define array with not defined value.. Is it ok? I think it makes warning or error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, this also shouldn't create issue as syscall will return a constant value based on CONFIG_SMP_NCPUS
No description provided.