Re: What is the point of this function?
Ok, thank you! Il 22 giu 2016 3:08 PM, "Daniel." ha scritto: > The function body you see will be use only when CONFIG_SMP is not > present. Take a look at > https://www.kernel.org/doc/Documentation/CodingStyle > Chapter 20: Conditional Compilation > > Regards, > > 2016-06-21 8:56 GMT-03:00 Andrea Benelli : > > So, it's just an override? > > Why return true and not false? > > > > Il 21 giu 2016 4:32 AM, "Nathan Williams" ha > scritto: > >> > >> On Tue, 2016-06-21 at 00:48 +0200, Andrea Benelli wrote: > >> > Hello, i was looking at the linux/sched.h (kernel version 4.6.2) > >> > source code and i found this function at line 1174: > >> > > >> > static inline bool cpus_share_cache(int this_cpu, int that_cpu) > >> > { > >> > return true; > >> > } > >> > > >> > I'm not able to understand the utility of a function that just return > >> > a true value. > >> > i've noticed that there are a lot of functions like this (function > >> > that just return a constant). > >> > >> Hi Andrea, > >> > >> That's the case for when CONFIG_SMP isn't defined. What happens when > >> CONFIG_SMP is defined? > >> > >> I suggest having a look through the code with a Linux cross reference: > >> > >> http://lxr.free-electrons.com/ident?v=4.6;i=cpus_share_cache > >> > >> Regards, > >> Nathan > >> > > > > ___ > > Kernelnewbies mailing list > > Kernelnewbies@kernelnewbies.org > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > > -- > "Do or do not. There is no try" > Yoda Master > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: What is the point of this function?
The function body you see will be use only when CONFIG_SMP is not present. Take a look at https://www.kernel.org/doc/Documentation/CodingStyle Chapter 20: Conditional Compilation Regards, 2016-06-21 8:56 GMT-03:00 Andrea Benelli : > So, it's just an override? > Why return true and not false? > > Il 21 giu 2016 4:32 AM, "Nathan Williams" ha scritto: >> >> On Tue, 2016-06-21 at 00:48 +0200, Andrea Benelli wrote: >> > Hello, i was looking at the linux/sched.h (kernel version 4.6.2) >> > source code and i found this function at line 1174: >> > >> > static inline bool cpus_share_cache(int this_cpu, int that_cpu) >> > { >> > return true; >> > } >> > >> > I'm not able to understand the utility of a function that just return >> > a true value. >> > i've noticed that there are a lot of functions like this (function >> > that just return a constant). >> >> Hi Andrea, >> >> That's the case for when CONFIG_SMP isn't defined. What happens when >> CONFIG_SMP is defined? >> >> I suggest having a look through the code with a Linux cross reference: >> >> http://lxr.free-electrons.com/ident?v=4.6;i=cpus_share_cache >> >> Regards, >> Nathan >> > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > -- "Do or do not. There is no try" Yoda Master ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: What is the point of this function?
So, it's just an override? Why return true and not false? Il 21 giu 2016 4:32 AM, "Nathan Williams" ha scritto: > On Tue, 2016-06-21 at 00:48 +0200, Andrea Benelli wrote: > > Hello, i was looking at the linux/sched.h (kernel version 4.6.2) > > source code and i found this function at line 1174: > > > > static inline bool cpus_share_cache(int this_cpu, int that_cpu) > > { > > return true; > > } > > > > I'm not able to understand the utility of a function that just return > > a true value. > > i've noticed that there are a lot of functions like this (function > > that just return a constant). > > Hi Andrea, > > That's the case for when CONFIG_SMP isn't defined. What happens when > CONFIG_SMP is defined? > > I suggest having a look through the code with a Linux cross reference: > > http://lxr.free-electrons.com/ident?v=4.6;i=cpus_share_cache > > Regards, > Nathan > > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: What is the point of this function?
On Tue, 2016-06-21 at 00:48 +0200, Andrea Benelli wrote: > Hello, i was looking at the linux/sched.h (kernel version 4.6.2) > source code and i found this function at line 1174: > > static inline bool cpus_share_cache(int this_cpu, int that_cpu) > { > return true; > } > > I'm not able to understand the utility of a function that just return > a true value. > i've noticed that there are a lot of functions like this (function > that just return a constant). Hi Andrea, That's the case for when CONFIG_SMP isn't defined. What happens when CONFIG_SMP is defined? I suggest having a look through the code with a Linux cross reference: http://lxr.free-electrons.com/ident?v=4.6;i=cpus_share_cache Regards, Nathan ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies