Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230815
b: refs/heads/master
c: 29c1f67
h: refs/heads/master
i:
  230813: 48a469b
  230811: aa1a7fa
  230807: 6d2bf2e
  230799: 566a5d3
  230783: 0bb77c6
v: v3
  • Loading branch information
Mel Gorman authored and Linus Torvalds committed Jan 14, 2011
1 parent 51de921 commit 7f80343
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22e5c47ee238abe636655c3862ed28d6eb084ad4
refs/heads/master: 29c1f677d424e8c5683a837fc4f03fc9f19201d7
16 changes: 16 additions & 0 deletions trunk/include/linux/radix-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ static inline void *radix_tree_deref_slot(void **pslot)
return rcu_dereference(*pslot);
}

/**
* radix_tree_deref_slot_protected - dereference a slot without RCU lock but with tree lock held
* @pslot: pointer to slot, returned by radix_tree_lookup_slot
* Returns: item that was stored in that slot with any direct pointer flag
* removed.
*
* Similar to radix_tree_deref_slot but only used during migration when a pages
* mapping is being moved. The caller does not hold the RCU read lock but it
* must hold the tree lock to prevent parallel updates.
*/
static inline void *radix_tree_deref_slot_protected(void **pslot,
spinlock_t *treelock)
{
return rcu_dereference_protected(*pslot, lockdep_is_held(treelock));
}

/**
* radix_tree_deref_retry - check radix_tree_deref_slot
* @arg: pointer returned by radix_tree_deref_slot
Expand Down
4 changes: 2 additions & 2 deletions trunk/mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,

expected_count = 2 + page_has_private(page);
if (page_count(page) != expected_count ||
(struct page *)radix_tree_deref_slot(pslot) != page) {
radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) {
spin_unlock_irq(&mapping->tree_lock);
return -EAGAIN;
}
Expand Down Expand Up @@ -320,7 +320,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,

expected_count = 2 + page_has_private(page);
if (page_count(page) != expected_count ||
(struct page *)radix_tree_deref_slot(pslot) != page) {
radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) {
spin_unlock_irq(&mapping->tree_lock);
return -EAGAIN;
}
Expand Down

0 comments on commit 7f80343

Please sign in to comment.