* What is the point of this function? [not found] <CAPQXMLHzXhKzZyZx_0YWZMkr6MdPNDdd38Fh=vabGcRMcKXXjw@mail.gmail.com> @ 2016-06-20 22:48 ` Andrea Benelli 2016-06-21 2:31 ` Nathan Williams 0 siblings, 1 reply; 5+ messages in thread From: Andrea Benelli @ 2016-06-20 22:48 UTC (permalink / raw) To: kernelnewbies 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). so...why? thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160621/5be09bcd/attachment.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* What is the point of this function? 2016-06-20 22:48 ` What is the point of this function? Andrea Benelli @ 2016-06-21 2:31 ` Nathan Williams 2016-06-21 11:56 ` Andrea Benelli 0 siblings, 1 reply; 5+ messages in thread From: Nathan Williams @ 2016-06-21 2:31 UTC (permalink / raw) To: kernelnewbies 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* What is the point of this function? 2016-06-21 2:31 ` Nathan Williams @ 2016-06-21 11:56 ` Andrea Benelli 2016-06-22 13:08 ` Daniel. 0 siblings, 1 reply; 5+ messages in thread From: Andrea Benelli @ 2016-06-21 11:56 UTC (permalink / raw) To: kernelnewbies So, it's just an override? Why return true and not false? Il 21 giu 2016 4:32 AM, "Nathan Williams" <ngwilliams@gmail.com> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160621/36e5606f/attachment-0001.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* What is the point of this function? 2016-06-21 11:56 ` Andrea Benelli @ 2016-06-22 13:08 ` Daniel. 2016-06-23 7:58 ` Andrea Benelli 0 siblings, 1 reply; 5+ messages in thread From: Daniel. @ 2016-06-22 13:08 UTC (permalink / raw) To: kernelnewbies 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 <andreabenelli77@gmail.com>: > So, it's just an override? > Why return true and not false? > > Il 21 giu 2016 4:32 AM, "Nathan Williams" <ngwilliams@gmail.com> 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 at kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > -- "Do or do not. There is no try" Yoda Master ^ permalink raw reply [flat|nested] 5+ messages in thread
* What is the point of this function? 2016-06-22 13:08 ` Daniel. @ 2016-06-23 7:58 ` Andrea Benelli 0 siblings, 0 replies; 5+ messages in thread From: Andrea Benelli @ 2016-06-23 7:58 UTC (permalink / raw) To: kernelnewbies Ok, thank you! Il 22 giu 2016 3:08 PM, "Daniel." <danielhilst@gmail.com> 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 <andreabenelli77@gmail.com>: > > So, it's just an override? > > Why return true and not false? > > > > Il 21 giu 2016 4:32 AM, "Nathan Williams" <ngwilliams@gmail.com> 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 at kernelnewbies.org > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > > -- > "Do or do not. There is no try" > Yoda Master > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160623/da155a5e/attachment.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-23 7:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAPQXMLHzXhKzZyZx_0YWZMkr6MdPNDdd38Fh=vabGcRMcKXXjw@mail.gmail.com>
2016-06-20 22:48 ` What is the point of this function? Andrea Benelli
2016-06-21 2:31 ` Nathan Williams
2016-06-21 11:56 ` Andrea Benelli
2016-06-22 13:08 ` Daniel.
2016-06-23 7:58 ` Andrea Benelli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).