Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1525049
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 5/9] lib: radix-tree: check accounting of existing slot replacement users |
| Date | 2016-11-18 08:50 +0100 |
| Message-ID | <sEM5P-46F-3@gated-at.bofh.it> (permalink) |
| References | <sEAo1-4ON-15@gated-at.bofh.it> <sEAHo-4VW-43@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu 17-11-16 14:30:21, Johannes Weiner wrote: > The bug in khugepaged fixed earlier in this series shows that radix > tree slot replacement is fragile; and it will become more so when not > only NULL<->!NULL transitions need to be caught but transitions from > and to exceptional entries as well. We need checks. > > Re-implement radix_tree_replace_slot() on top of the sanity-checked > __radix_tree_replace(). This requires existing callers to also pass > the radix tree root, but it'll warn us when somebody replaces slots > with contents that need proper accounting (transitions between NULL > entries, real entries, exceptional entries) and where a replacement > through the slot pointer would corrupt the radix tree node counts. > > Suggested-by: Jan Kara <jack@suse.cz> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Looks good. You can add: Reviewed-by: Jan Kara <jack@suse.cz> One nit below: > @@ -785,6 +776,50 @@ void __radix_tree_replace(struct radix_tree_root *root, > } > > /** > + * __radix_tree_replace - replace item in a slot > + * @root: radix tree root > + * @node: pointer to tree node > + * @slot: pointer to slot in @node > + * @item: new item to store in the slot. > + * > + * For use with __radix_tree_lookup(). Caller must hold tree write locked > + * across slot lookup and replacement. > + */ I'd comment here that even this function cannot be used for NULL <-> non-NULL replacements. For that are radix_tree_delete() and radix_tree_insert(). Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/9] mm: workingset: radix tree subtleties & single-page file refaults v3 Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:20 +0100
[PATCH 4/9] lib: radix-tree: native accounting of exceptional entries Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:40 +0100
Re: [PATCH 4/9] lib: radix-tree: native accounting of exceptional entries Jan Kara <jack@suse.cz> - 2016-11-18 08:40 +0100
[PATCH 6/9] lib: radix-tree: add entry deletion support to __radix_tree_replace() Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:40 +0100
Re: [PATCH 6/9] lib: radix-tree: add entry deletion support to __radix_tree_replace() Jan Kara <jack@suse.cz> - 2016-11-18 09:20 +0100
[PATCH 8/9] mm: workingset: move shadow entry tracking to radix tree exceptional tracking Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:40 +0100
Re: [PATCH 8/9] mm: workingset: move shadow entry tracking to radix tree exceptional tracking Jan Kara <jack@suse.cz> - 2016-11-18 09:30 +0100
[PATCH 7/9] lib: radix-tree: update callback for changing leaf nodes Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:40 +0100
Re: [PATCH 7/9] lib: radix-tree: update callback for changing leaf nodes Jan Kara <jack@suse.cz> - 2016-11-18 09:30 +0100
[PATCH 5/9] lib: radix-tree: check accounting of existing slot replacement users Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:40 +0100
Re: [PATCH 5/9] lib: radix-tree: check accounting of existing slot replacement users Jan Kara <jack@suse.cz> - 2016-11-18 08:50 +0100
[PATCH 9/9] mm: workingset: restore refault tracking for single-page files Johannes Weiner <hannes@cmpxchg.org> - 2016-11-17 20:40 +0100
Re: [PATCH 9/9] mm: workingset: restore refault tracking for single-page files Jan Kara <jack@suse.cz> - 2016-11-18 09:40 +0100
csiph-web