Skip to contentSkip to conversation

+ plist-add-plist_requeue.patch added to -mm tree

PATCH [email protected] 1 participant 1 message May 12, 2014 Library code

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + plist-add-plist_requeue.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 12 May 2014 14:01:29 -0700

The patch titled
Subject: lib/plist: add plist_requeue
has been added to the -mm tree. Its filename is
plist-add-plist_requeue.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/plist-add-plist_requeue.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/plist-add-plist_requeue.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Dan Streetman <[email protected]>
Subject: lib/plist: add plist_requeue

Add plist_requeue(), which moves the specified plist_node after all other same-priority plist_nodes in the list. This is essentially an optimized plist_del() followed by plist_add().

This is needed by swap, which (with the next patch in this set) uses a plist of available swap devices. When a swap device (either a swap partition or swap file) are added to the system with swapon(), the device is added to a plist, ordered by the swap device's priority. When swap needs to allocate a page from one of the swap devices, it takes the page from the first swap device on the plist, which is the highest priority swap device. The swap device is left in the plist until all its pages are used, and then removed from the plist when it becomes full.

However, as described in man 2 swapon, swap must allocate pages from swap devices with the same priority in round-robin order; to do this, on each swap page allocation, swap uses a page from the first swap device in the plist, and then calls plist_requeue() to move that swap device entry to after any other same-priority swap devices. The next swap page allocation will again use a page from the first swap device in the plist and requeue it, and so on, resulting in round-robin usage of equal-priority swap devices.

Also add plist_test_requeue() test function, for use by plist_test() to test plist_requeue() function.

Cc Steven Rostedt <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Paul Gortmaker <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Shaohua Li <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Dan Streetman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Christian Ehrhardt <[email protected]>
Cc Weijie Yang <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Bob Liu <[email protected]>

---

 include/linux/plist.h |    2 +
 lib/plist.c           |   52 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
include/linux/plist.h renamed from include/linux/plist.h~plist-add-plist_requeue +2 -0
diff -puN include/linux/plist.h~plist-add-plist_requeue include/linux/plist.h
@@ -141,6 +141,8 @@ static inline void plist_node_init(struc
 extern void plist_add(struct plist_node *node, struct plist_head *head);
 extern void plist_del(struct plist_node *node, struct plist_head *head);
 
+extern void plist_requeue(struct plist_node *node, struct plist_head *head);
+
 /**
  * plist_for_each - iterate over the plist
  * @pos:	the type * to use as a loop counter
lib/plist.c renamed from lib/plist.c~plist-add-plist_requeue +52 -0

70 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are

swap-change-swap_info-singly-linked-list-to-list_head.patch plist-add-helper-functions.patch plist-add-plist_requeue.patch swap-change-swap_list_head-to-plist-add-swap_avail_head.patch documentation-expand-clarify-debug-documentation.patch lib-plistc-replace-pr_debug-with-printk-in-plist_test.patch lib-plistc-make-config_debug_pi_list-selectable.patch