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

memory hotplug: document the memory hotplug notifier

Add description about event notification callback routine to the document

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Yasunori Goto and committed by
Linus Torvalds
10020ca2 a24e7851

+55 -3
+55 -3
Documentation/memory-hotplug.txt
··· 2 2 Memory Hotplug 3 3 ============== 4 4 5 - Last Updated: Jul 28 2007 5 + Created: Jul 28 2007 6 + Add description of notifier of memory hotplug Oct 11 2007 6 7 7 8 This document is about memory hotplug including how-to-use and current status. 8 9 Because Memory Hotplug is still under development, contents of this text will ··· 25 24 6.1 Memory offline and ZONE_MOVABLE 26 25 6.2. How to offline memory 27 26 7. Physical memory remove 28 - 8. Future Work List 27 + 8. Memory hotplug event notifier 28 + 9. Future Work List 29 29 30 30 Note(1): x86_64's has special implementation for memory hotplug. 31 31 This text does not describe it. ··· 309 307 - Notification completion of remove works by OS to firmware. 310 308 - Guard from remove if not yet. 311 309 310 + -------------------------------- 311 + 8. Memory hotplug event notifier 312 + -------------------------------- 313 + Memory hotplug has event notifer. There are 6 types of notification. 314 + 315 + MEMORY_GOING_ONLINE 316 + Generated before new memory becomes available in order to be able to 317 + prepare subsystems to handle memory. The page allocator is still unable 318 + to allocate from the new memory. 319 + 320 + MEMORY_CANCEL_ONLINE 321 + Generated if MEMORY_GOING_ONLINE fails. 322 + 323 + MEMORY_ONLINE 324 + Generated when memory has succesfully brought online. The callback may 325 + allocate pages from the new memory. 326 + 327 + MEMORY_GOING_OFFLINE 328 + Generated to begin the process of offlining memory. Allocations are no 329 + longer possible from the memory but some of the memory to be offlined 330 + is still in use. The callback can be used to free memory known to a 331 + subsystem from the indicated memory section. 332 + 333 + MEMORY_CANCEL_OFFLINE 334 + Generated if MEMORY_GOING_OFFLINE fails. Memory is available again from 335 + the section that we attempted to offline. 336 + 337 + MEMORY_OFFLINE 338 + Generated after offlining memory is complete. 339 + 340 + A callback routine can be registered by 341 + hotplug_memory_notifier(callback_func, priority) 342 + 343 + The second argument of callback function (action) is event types of above. 344 + The third argument is passed by pointer of struct memory_notify. 345 + 346 + struct memory_notify { 347 + unsigned long start_pfn; 348 + unsigned long nr_pages; 349 + int status_cahnge_nid; 350 + } 351 + 352 + start_pfn is start_pfn of online/offline memory. 353 + nr_pages is # of pages of online/offline memory. 354 + status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be) 355 + set/clear. It means a new(memoryless) node gets new memory by online and a 356 + node loses all memory. If this is -1, then nodemask status is not changed. 357 + If status_changed_nid >= 0, callback should create/discard structures for the 358 + node if necessary. 359 + 312 360 -------------- 313 - 8. Future Work 361 + 9. Future Work 314 362 -------------- 315 363 - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like 316 364 sysctl or new control file.