0

I am looking scheduling algorithm in

static void __sched notrace __schedule(bool preempt) (__schedule)

Along the way, I find # define __percpu __attribute__((noderef, address_space(3))) (address_space)

However, I cannot understand why struct address_space can be initialized by using round brackets( ) since I look through struct syntax in c language.

How to initialize a struct in accordance with C programming language standards. struct should be initialized by { } for each filed.

struct of address_space

So, what does address_space(3) mean?

skytree
  • 1,060
  • 2
  • 13
  • 38
  • 3
    Here `address_space` is an **attribute** of gcc. Its intention is to differentiate `per_cpu` pointers from "normal" pointers for *checker* tools. See also [that question](https://stackoverflow.com/questions/4521551/what-are-the-implications-of-the-linux-user-macro) which describes `__user` type modificator for user-space pointers. – Tsyvarev Oct 05 '17 at 17:45
  • @Tsyvarev So, in another word, the `address_space` is totally not what [struct address_space](http://elixir.free-electrons.com/linux/v4.13.4/source/include/linux/fs.h#L388), the website gives a wrong index ...? – skytree Oct 06 '17 at 03:45
  • 1
    The website says that there is `address_space` structure, defined in `linux/fs.h`, but it doesn't imply, that exactly this structure is referenced in `__percpu` definition. Given website provides identificator references with basic knowledge of C language. In most cases this reference is sufficient for navigate between type/function/variable usage and its definition. But the website is completely unaware about gcc specifics. E.g., `__attribute__` is a *keyword* in gcc. – Tsyvarev Oct 06 '17 at 07:25

0 Answers0