1 /* { dg-do compile } */
2 /* { dg-options "-O2 -w -fdump-tree-optimized" } */
4 extern void XYZZY (void);
5 typedef unsigned long __kernel_size_t
;
6 typedef __kernel_size_t
size_t;
7 typedef unsigned gfp_t
;
8 struct per_cpu_pageset
{ } __attribute__ ((__aligned__ ((1 << (6)))));
9 struct zone
{ struct per_cpu_pageset
*pageset
[64]; }
10 zone_flags_t
; typedef struct pglist_data
{ struct zone node_zones
[4]; } pg_data_t
;
11 extern struct pglist_data
*first_online_pgdat (void);
12 extern struct zone
*next_zone (struct zone
*zone
);
13 extern volatile int per_cpu__x86_cpu_to_node_map
[];
14 struct kmem_cache
{ int size
; };
15 extern struct kmem_cache kmalloc_caches
[(12 + 2)];
16 struct tracepoint
{ void **funcs
; } __attribute__ ((aligned (32)));
17 extern struct tracepoint __tracepoint_kmalloc_node
;
18 void *__kmalloc_node (size_t size
, gfp_t flags
, int node
);
23 return per_cpu__x86_cpu_to_node_map
[cpu
];
27 trace_kmalloc_node (unsigned long call_site
, const void *ptr
,
28 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
,
31 asm goto ("" : : : : trace_label
);
36 asm ("" : "=r"(it_func
) : "0"(&__tracepoint_kmalloc_node
.funcs
));
40 static inline __attribute__ ((always_inline
)) int
41 kmalloc_index (size_t size
)
48 static inline __attribute__ ((always_inline
)) struct kmem_cache
*
49 kmalloc_slab (size_t size
)
51 int index
= kmalloc_index (size
);
54 return &kmalloc_caches
[index
];
57 static inline __attribute__ ((always_inline
)) void *
58 kmalloc_node (size_t size
, gfp_t flags
, int node
)
61 if (__builtin_constant_p (size
) && size
<= (2 * ((1UL) << 12))
62 && !(flags
& ((gfp_t
) 0x01u
)))
64 struct kmem_cache
*s
= kmalloc_slab (size
);
67 trace_kmalloc_node (({ __here
:(unsigned long) &&__here
;}),
68 ret
, size
, s
->size
, flags
, node
);
70 return __kmalloc_node (size
, flags
, node
);
74 process_zones (int cpu
)
76 struct zone
*zone
, *dzone
;
77 int node
= cpu_to_node (cpu
);
78 for (zone
= (first_online_pgdat ())->node_zones
;
79 zone
; zone
= next_zone (zone
))
81 ((zone
)->pageset
[(cpu
)]) =
82 kmalloc_node (sizeof (struct per_cpu_pageset
),
83 (((gfp_t
) 0x10u
) | ((gfp_t
) 0x40u
) | ((gfp_t
) 0x80u
)),
85 if (!((zone
)->pageset
[(cpu
)]))
94 /* { dg-final { scan-tree-dump-times "XYZZY" 1 "optimized" } } */