aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/memory-hotplug.txt
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2015-02-21 18:18:49 -0500
committerJonathan Corbet <corbet@lwn.net>2015-02-27 17:05:08 -0500
commit433b89cfb40f6bb6e6b6c899d06e40dd4f2ed100 (patch)
tree4b71b69bdc720024bcfecf30c71cfe2992e183c3 /Documentation/memory-hotplug.txt
parent09677e0ff8a115162cfa763b7ad2d753f11fce9f (diff)
Doc/memory-hotplug.txt: corrections and callback function prototype
Documentation/memory-hotplug.txt describes that a callback function can be added to the notification chain by calling hotplug_memory_notifier(). The function prototype of the callback function is mssing. This missing information is added by the patch. The description of the arguments of the callback function is reworked. The constants for the event types are corrected. The possible return values are explained. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/memory-hotplug.txt')
-rw-r--r--Documentation/memory-hotplug.txt45
1 files changed, 35 insertions, 10 deletions
diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
index ea03abfc97e9..c5a064508a3c 100644
--- a/Documentation/memory-hotplug.txt
+++ b/Documentation/memory-hotplug.txt
@@ -359,38 +359,51 @@ Need more implementation yet....
359-------------------------------- 359--------------------------------
3608. Memory hotplug event notifier 3608. Memory hotplug event notifier
361-------------------------------- 361--------------------------------
362Memory hotplug has event notifier. There are 6 types of notification. 362Hotplugging events are sent to a notification queue.
363 363
364MEMORY_GOING_ONLINE 364There are six types of notification defined in include/linux/memory.h:
365
366MEM_GOING_ONLINE
365 Generated before new memory becomes available in order to be able to 367 Generated before new memory becomes available in order to be able to
366 prepare subsystems to handle memory. The page allocator is still unable 368 prepare subsystems to handle memory. The page allocator is still unable
367 to allocate from the new memory. 369 to allocate from the new memory.
368 370
369MEMORY_CANCEL_ONLINE 371MEM_CANCEL_ONLINE
370 Generated if MEMORY_GOING_ONLINE fails. 372 Generated if MEMORY_GOING_ONLINE fails.
371 373
372MEMORY_ONLINE 374MEM_ONLINE
373 Generated when memory has successfully brought online. The callback may 375 Generated when memory has successfully brought online. The callback may
374 allocate pages from the new memory. 376 allocate pages from the new memory.
375 377
376MEMORY_GOING_OFFLINE 378MEM_GOING_OFFLINE
377 Generated to begin the process of offlining memory. Allocations are no 379 Generated to begin the process of offlining memory. Allocations are no
378 longer possible from the memory but some of the memory to be offlined 380 longer possible from the memory but some of the memory to be offlined
379 is still in use. The callback can be used to free memory known to a 381 is still in use. The callback can be used to free memory known to a
380 subsystem from the indicated memory block. 382 subsystem from the indicated memory block.
381 383
382MEMORY_CANCEL_OFFLINE 384MEM_CANCEL_OFFLINE
383 Generated if MEMORY_GOING_OFFLINE fails. Memory is available again from 385 Generated if MEMORY_GOING_OFFLINE fails. Memory is available again from
384 the memory block that we attempted to offline. 386 the memory block that we attempted to offline.
385 387
386MEMORY_OFFLINE 388MEM_OFFLINE
387 Generated after offlining memory is complete. 389 Generated after offlining memory is complete.
388 390
389A callback routine can be registered by 391A callback routine can be registered by calling
392
390 hotplug_memory_notifier(callback_func, priority) 393 hotplug_memory_notifier(callback_func, priority)
391 394
392The second argument of callback function (action) is event types of above. 395Callback functions with higher values of priority are called before callback
393The third argument is passed by pointer of struct memory_notify. 396functions with lower values.
397
398A callback function must have the following prototype:
399
400 int callback_func(
401 struct notifier_block *self, unsigned long action, void *arg);
402
403The first argument of the callback function (self) is a pointer to the block
404of the notifier chain that points to the callback function itself.
405The second argument (action) is one of the event types described above.
406The third argument (arg) passes a pointer of struct memory_notify.
394 407
395struct memory_notify { 408struct memory_notify {
396 unsigned long start_pfn; 409 unsigned long start_pfn;
@@ -412,6 +425,18 @@ node loses all memory. If this is -1, then nodemask status is not changed.
412If status_changed_nid* >= 0, callback should create/discard structures for the 425If status_changed_nid* >= 0, callback should create/discard structures for the
413node if necessary. 426node if necessary.
414 427
428The callback routine shall return one of the values
429NOTIFY_DONE, NOTIFY_OK, NOTIFY_BAD, NOTIFY_STOP
430defined in include/linux/notifier.h
431
432NOTIFY_DONE and NOTIFY_OK have no effect on the further processing.
433
434NOTIFY_BAD is used as response to the MEM_GOING_ONLINE, MEM_GOING_OFFLINE,
435MEM_ONLINE, or MEM_OFFLINE action to cancel hotplugging. It stops
436further processing of the notification queue.
437
438NOTIFY_STOP stops further processing of the notification queue.
439
415-------------- 440--------------
4169. Future Work 4419. Future Work
417-------------- 442--------------