Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/memory-failure: remove the selection of RAS

commit 97f0b13452198290799f ("tracing: add trace event for
memory-failure") introduces the selection of RAS in memory-failure. This
commit is just a tracing feature; in reality, there is no dependency
between memory-failure and RAS. RAS increases the size of the bzImage
image by 8k, which is very valuable for embedded devices.

Move the memory-failure traceing code from ras_event.h to
memory-failure.h and remove the selection of RAS.

Link: https://lkml.kernel.org/r/20251119095943.67125-1-xieyuanbin1@huawei.com
Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Acked-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Xie Yuanbin and committed by
Andrew Morton
31807483 519912bd

+103 -89
+1
MAINTAINERS
··· 11560 11560 L: linux-mm@kvack.org 11561 11561 S: Maintained 11562 11562 F: include/linux/memory-failure.h 11563 + F: include/trace/events/memory-failure.h 11563 11564 F: mm/hwpoison-inject.c 11564 11565 F: mm/memory-failure.c 11565 11566
-87
include/ras/ras_event.h
··· 12 12 #include <linux/pci.h> 13 13 #include <linux/aer.h> 14 14 #include <linux/cper.h> 15 - #include <linux/mm.h> 16 15 17 16 /* 18 17 * MCE Extended Error Log trace event ··· 338 339 "Not available") 339 340 ); 340 341 #endif /* CONFIG_PCIEAER */ 341 - 342 - /* 343 - * memory-failure recovery action result event 344 - * 345 - * unsigned long pfn - Page Frame Number of the corrupted page 346 - * int type - Page types of the corrupted page 347 - * int result - Result of recovery action 348 - */ 349 - 350 - #ifdef CONFIG_MEMORY_FAILURE 351 - #define MF_ACTION_RESULT \ 352 - EM ( MF_IGNORED, "Ignored" ) \ 353 - EM ( MF_FAILED, "Failed" ) \ 354 - EM ( MF_DELAYED, "Delayed" ) \ 355 - EMe ( MF_RECOVERED, "Recovered" ) 356 - 357 - #define MF_PAGE_TYPE \ 358 - EM ( MF_MSG_KERNEL, "reserved kernel page" ) \ 359 - EM ( MF_MSG_KERNEL_HIGH_ORDER, "high-order kernel page" ) \ 360 - EM ( MF_MSG_HUGE, "huge page" ) \ 361 - EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ 362 - EM ( MF_MSG_GET_HWPOISON, "get hwpoison page" ) \ 363 - EM ( MF_MSG_UNMAP_FAILED, "unmapping failed page" ) \ 364 - EM ( MF_MSG_DIRTY_SWAPCACHE, "dirty swapcache page" ) \ 365 - EM ( MF_MSG_CLEAN_SWAPCACHE, "clean swapcache page" ) \ 366 - EM ( MF_MSG_DIRTY_MLOCKED_LRU, "dirty mlocked LRU page" ) \ 367 - EM ( MF_MSG_CLEAN_MLOCKED_LRU, "clean mlocked LRU page" ) \ 368 - EM ( MF_MSG_DIRTY_UNEVICTABLE_LRU, "dirty unevictable LRU page" ) \ 369 - EM ( MF_MSG_CLEAN_UNEVICTABLE_LRU, "clean unevictable LRU page" ) \ 370 - EM ( MF_MSG_DIRTY_LRU, "dirty LRU page" ) \ 371 - EM ( MF_MSG_CLEAN_LRU, "clean LRU page" ) \ 372 - EM ( MF_MSG_TRUNCATED_LRU, "already truncated LRU page" ) \ 373 - EM ( MF_MSG_BUDDY, "free buddy page" ) \ 374 - EM ( MF_MSG_DAX, "dax page" ) \ 375 - EM ( MF_MSG_UNSPLIT_THP, "unsplit thp" ) \ 376 - EM ( MF_MSG_ALREADY_POISONED, "already poisoned" ) \ 377 - EM ( MF_MSG_PFN_MAP, "non struct page pfn" ) \ 378 - EMe ( MF_MSG_UNKNOWN, "unknown page" ) 379 - 380 - /* 381 - * First define the enums in MM_ACTION_RESULT to be exported to userspace 382 - * via TRACE_DEFINE_ENUM(). 383 - */ 384 - #undef EM 385 - #undef EMe 386 - #define EM(a, b) TRACE_DEFINE_ENUM(a); 387 - #define EMe(a, b) TRACE_DEFINE_ENUM(a); 388 - 389 - MF_ACTION_RESULT 390 - MF_PAGE_TYPE 391 - 392 - /* 393 - * Now redefine the EM() and EMe() macros to map the enums to the strings 394 - * that will be printed in the output. 395 - */ 396 - #undef EM 397 - #undef EMe 398 - #define EM(a, b) { a, b }, 399 - #define EMe(a, b) { a, b } 400 - 401 - TRACE_EVENT(memory_failure_event, 402 - TP_PROTO(unsigned long pfn, 403 - int type, 404 - int result), 405 - 406 - TP_ARGS(pfn, type, result), 407 - 408 - TP_STRUCT__entry( 409 - __field(unsigned long, pfn) 410 - __field(int, type) 411 - __field(int, result) 412 - ), 413 - 414 - TP_fast_assign( 415 - __entry->pfn = pfn; 416 - __entry->type = type; 417 - __entry->result = result; 418 - ), 419 - 420 - TP_printk("pfn %#lx: recovery action for %s: %s", 421 - __entry->pfn, 422 - __print_symbolic(__entry->type, MF_PAGE_TYPE), 423 - __print_symbolic(__entry->result, MF_ACTION_RESULT) 424 - ) 425 - ); 426 - #endif /* CONFIG_MEMORY_FAILURE */ 427 342 #endif /* _TRACE_HW_EVENT_MC_H */ 428 343 429 344 /* This part must be outside protection */
+98
include/trace/events/memory-failure.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #undef TRACE_SYSTEM 3 + #define TRACE_SYSTEM memory_failure 4 + #define TRACE_INCLUDE_FILE memory-failure 5 + 6 + #if !defined(_TRACE_MEMORY_FAILURE_H) || defined(TRACE_HEADER_MULTI_READ) 7 + #define _TRACE_MEMORY_FAILURE_H 8 + 9 + #include <linux/tracepoint.h> 10 + #include <linux/mm.h> 11 + 12 + /* 13 + * memory-failure recovery action result event 14 + * 15 + * unsigned long pfn - Page Frame Number of the corrupted page 16 + * int type - Page types of the corrupted page 17 + * int result - Result of recovery action 18 + */ 19 + 20 + #define MF_ACTION_RESULT \ 21 + EM ( MF_IGNORED, "Ignored" ) \ 22 + EM ( MF_FAILED, "Failed" ) \ 23 + EM ( MF_DELAYED, "Delayed" ) \ 24 + EMe ( MF_RECOVERED, "Recovered" ) 25 + 26 + #define MF_PAGE_TYPE \ 27 + EM ( MF_MSG_KERNEL, "reserved kernel page" ) \ 28 + EM ( MF_MSG_KERNEL_HIGH_ORDER, "high-order kernel page" ) \ 29 + EM ( MF_MSG_HUGE, "huge page" ) \ 30 + EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ 31 + EM ( MF_MSG_GET_HWPOISON, "get hwpoison page" ) \ 32 + EM ( MF_MSG_UNMAP_FAILED, "unmapping failed page" ) \ 33 + EM ( MF_MSG_DIRTY_SWAPCACHE, "dirty swapcache page" ) \ 34 + EM ( MF_MSG_CLEAN_SWAPCACHE, "clean swapcache page" ) \ 35 + EM ( MF_MSG_DIRTY_MLOCKED_LRU, "dirty mlocked LRU page" ) \ 36 + EM ( MF_MSG_CLEAN_MLOCKED_LRU, "clean mlocked LRU page" ) \ 37 + EM ( MF_MSG_DIRTY_UNEVICTABLE_LRU, "dirty unevictable LRU page" ) \ 38 + EM ( MF_MSG_CLEAN_UNEVICTABLE_LRU, "clean unevictable LRU page" ) \ 39 + EM ( MF_MSG_DIRTY_LRU, "dirty LRU page" ) \ 40 + EM ( MF_MSG_CLEAN_LRU, "clean LRU page" ) \ 41 + EM ( MF_MSG_TRUNCATED_LRU, "already truncated LRU page" ) \ 42 + EM ( MF_MSG_BUDDY, "free buddy page" ) \ 43 + EM ( MF_MSG_DAX, "dax page" ) \ 44 + EM ( MF_MSG_UNSPLIT_THP, "unsplit thp" ) \ 45 + EM ( MF_MSG_ALREADY_POISONED, "already poisoned" ) \ 46 + EM ( MF_MSG_PFN_MAP, "non struct page pfn" ) \ 47 + EMe ( MF_MSG_UNKNOWN, "unknown page" ) 48 + 49 + /* 50 + * First define the enums in MM_ACTION_RESULT to be exported to userspace 51 + * via TRACE_DEFINE_ENUM(). 52 + */ 53 + #undef EM 54 + #undef EMe 55 + #define EM(a, b) TRACE_DEFINE_ENUM(a); 56 + #define EMe(a, b) TRACE_DEFINE_ENUM(a); 57 + 58 + MF_ACTION_RESULT 59 + MF_PAGE_TYPE 60 + 61 + /* 62 + * Now redefine the EM() and EMe() macros to map the enums to the strings 63 + * that will be printed in the output. 64 + */ 65 + #undef EM 66 + #undef EMe 67 + #define EM(a, b) { a, b }, 68 + #define EMe(a, b) { a, b } 69 + 70 + TRACE_EVENT(memory_failure_event, 71 + TP_PROTO(unsigned long pfn, 72 + int type, 73 + int result), 74 + 75 + TP_ARGS(pfn, type, result), 76 + 77 + TP_STRUCT__entry( 78 + __field(unsigned long, pfn) 79 + __field(int, type) 80 + __field(int, result) 81 + ), 82 + 83 + TP_fast_assign( 84 + __entry->pfn = pfn; 85 + __entry->type = type; 86 + __entry->result = result; 87 + ), 88 + 89 + TP_printk("pfn %#lx: recovery action for %s: %s", 90 + __entry->pfn, 91 + __print_symbolic(__entry->type, MF_PAGE_TYPE), 92 + __print_symbolic(__entry->result, MF_ACTION_RESULT) 93 + ) 94 + ); 95 + #endif /* _TRACE_MEMORY_FAILURE_H */ 96 + 97 + /* This part must be outside protection */ 98 + #include <trace/define_trace.h>
-1
mm/Kconfig
··· 740 740 depends on MMU 741 741 depends on ARCH_SUPPORTS_MEMORY_FAILURE 742 742 bool "Enable recovery from hardware memory errors" 743 - select RAS 744 743 select INTERVAL_TREE 745 744 help 746 745 Enables code to recover from some memory failures on systems
+4 -1
mm/memory-failure.c
··· 61 61 #include <linux/pagewalk.h> 62 62 #include <linux/shmem_fs.h> 63 63 #include <linux/sysctl.h> 64 + 65 + #define CREATE_TRACE_POINTS 66 + #include <trace/events/memory-failure.h> 67 + 64 68 #include "swap.h" 65 69 #include "internal.h" 66 - #include "ras/ras_event.h" 67 70 68 71 static int sysctl_memory_failure_early_kill __read_mostly; 69 72