diff options
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ring_buffer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 830a2930dd91..95ca9338cb6c 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -289,6 +289,12 @@ static void rb_free_cpu_buffer(struct ring_buffer_per_cpu *cpu_buffer) | |||
289 | kfree(cpu_buffer); | 289 | kfree(cpu_buffer); |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | ||
293 | * Causes compile errors if the struct buffer_page gets bigger | ||
294 | * than the struct page. | ||
295 | */ | ||
296 | extern int ring_buffer_page_too_big(void); | ||
297 | |||
292 | /** | 298 | /** |
293 | * ring_buffer_alloc - allocate a new ring_buffer | 299 | * ring_buffer_alloc - allocate a new ring_buffer |
294 | * @size: the size in bytes that is needed. | 300 | * @size: the size in bytes that is needed. |
@@ -305,6 +311,11 @@ struct ring_buffer *ring_buffer_alloc(unsigned long size, unsigned flags) | |||
305 | int bsize; | 311 | int bsize; |
306 | int cpu; | 312 | int cpu; |
307 | 313 | ||
314 | /* Paranoid! Optimizes out when all is well */ | ||
315 | if (sizeof(struct buffer_page) > sizeof(struct page)) | ||
316 | ring_buffer_page_too_big(); | ||
317 | |||
318 | |||
308 | /* keep it in its own cache line */ | 319 | /* keep it in its own cache line */ |
309 | buffer = kzalloc(ALIGN(sizeof(*buffer), cache_line_size()), | 320 | buffer = kzalloc(ALIGN(sizeof(*buffer), cache_line_size()), |
310 | GFP_KERNEL); | 321 | GFP_KERNEL); |