Cody P Schafer
8de1ee7ebf
rbtree: clarify documentation of rbtree_postorder_for_each_entry_safe()
...
I noticed that commit a20135ffbc ("writeback: don't drain
bdi_writeback_congested on bdi destruction") added a usage of
rbtree_postorder_for_each_entry_safe() in mm/backing-dev.c which appears
to try to rb_erase() elements from an rbtree while iterating over it using
rbtree_postorder_for_each_entry_safe().
Doing this will cause random nodes to be missed by the iteration because
rb_erase() may rebalance the tree, changing the ordering that we're trying
to iterate over.
The previous documentation for rbtree_postorder_for_each_entry_safe()
wasn't clear that this wasn't allowed, it was taken from the docs for
list_for_each_entry_safe(), where erasing isn't a problem due to
list_del() not reordering.
Explicitly warn developers about this potential pit-fall.
Note that I haven't fixed the actual issue that (it appears) the commit
referenced above introduced (not familiar enough with that code).
In general (and in this case), the patterns to follow are:
- switch to rb_first() + rb_erase(), don't use
rbtree_postorder_for_each_entry_safe().
- keep the postorder iteration and don't rb_erase() at all. Instead
just clear the fields of rb_node & cgwb_congested_tree as required by
other users of those structures.
[akpm@linux-foundation.org: tweak comments]
Signed-off-by: Cody P Schafer <dev@codyps.com>
Cc: John de la Garza <john@jjdev.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-06 17:50:42 -08:00
..
2015-10-19 17:08:32 +01:00
2015-09-29 10:56:05 +03:00
2014-08-06 18:01:23 -07:00
2015-10-09 07:49:01 -07:00
2015-09-17 20:14:27 +03:00
2015-10-01 12:48:11 -07:00
2015-10-17 21:22:08 -07:00
2015-09-30 19:22:50 +09:00
2015-10-07 18:08:15 +01:00
2015-10-21 18:05:50 -05:00
2015-10-16 22:11:16 +02:00
2015-08-27 20:47:09 +01:00
2015-07-11 17:27:36 -07:00
2015-11-04 18:10:13 -08:00
2015-11-06 10:23:50 -08:00
2015-10-14 19:14:44 -07:00
2015-10-14 19:14:43 -07:00
2015-10-27 10:38:41 +01:00
2015-10-09 07:49:00 -07:00
2015-09-18 21:57:43 +02:00
2015-09-18 21:57:35 +02:00
2015-09-18 21:57:43 +02:00
2015-09-18 21:57:43 +02:00
2015-06-03 14:13:41 +09:00
2015-10-27 11:24:23 +01:00
2015-11-04 21:35:12 -08:00
2015-09-23 17:15:27 +02:00
2015-10-27 19:34:54 -07:00
2015-04-22 08:00:41 +10:00
2015-10-16 17:57:33 +01:00
2015-09-23 09:51:25 +02:00
2015-11-04 11:02:12 +00:00
2015-06-21 21:52:24 +02:00
2015-09-17 18:01:28 -04:00
2015-11-04 21:26:27 -08:00
2014-08-07 14:40:09 -04:00
2015-11-04 18:10:13 -08:00
2012-10-13 10:46:48 +01:00
2005-04-16 15:20:36 -07:00
2012-05-29 16:22:29 -07:00
2012-10-08 13:50:20 +10:30
2013-09-24 10:35:17 +01:00
2013-12-02 11:24:18 +00:00
2015-01-28 18:45:23 -05:00
2012-12-02 00:05:12 +00:00
2015-11-03 17:22:17 -08:00
2012-03-16 10:38:24 -04:00
2015-11-04 08:23:51 -05:00
2013-12-24 09:35:17 -08:00
2015-08-20 14:10:23 -07:00
2015-10-12 10:31:12 -06:00
2015-11-05 14:51:32 -08:00
2015-06-23 15:47:35 +01:00
2015-08-19 14:26:02 -07:00
2012-03-04 17:54:34 -05:00
2015-08-05 09:38:08 +02:00
2015-11-06 17:50:42 -08:00
2015-09-03 12:28:30 -07:00
2015-10-27 15:04:56 +09:00
2015-10-21 14:43:41 -06:00
2015-11-04 21:01:27 -08:00
2013-11-08 09:04:30 -07:00
2015-06-24 17:49:41 -07:00
2015-05-19 08:39:11 +02:00
2015-11-02 22:48:39 -05:00
2015-10-08 04:45:52 -07:00
2015-07-02 01:32:44 -04:00
2013-02-21 17:22:16 -08:00
2014-01-23 16:36:56 -08:00
2015-01-20 14:02:58 -07:00
2012-10-13 10:46:48 +01:00
2015-09-10 18:56:14 -07:00
2015-10-15 16:41:53 -04:00
2015-10-15 16:41:53 -04:00
2015-10-26 12:36:55 -07:00
2015-07-17 16:39:53 -07:00
2015-09-14 11:00:55 +02:00
2015-10-01 02:18:39 +02:00
2015-10-23 17:55:10 +09:00
2014-01-21 20:18:26 -08:00
2015-11-05 19:34:48 -08:00
2015-07-17 16:39:53 -07:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2014-07-03 11:32:43 +01:00
2008-04-30 08:29:54 -07:00
2015-05-10 19:15:52 +02:00
2015-06-25 17:00:38 -07:00
2008-06-04 14:56:12 +01:00
2015-07-07 10:59:04 +02:00
2015-10-07 17:54:09 +01:00
2015-10-07 16:02:49 -07:00
2015-10-28 09:21:12 +01:00
2015-11-06 17:50:42 -08:00
2014-05-16 14:26:52 -04:00
2015-09-04 16:54:41 -07:00
2015-09-08 15:35:28 -07:00
2009-09-10 10:00:05 -07:00
2015-07-17 16:39:53 -07:00
2015-10-09 07:49:02 -07:00
2013-05-12 14:16:21 +02:00
2015-10-18 10:14:39 -07:00
2013-08-18 17:39:55 -07:00
2010-03-30 22:02:32 +09:00
2015-09-11 14:23:29 +09:00
2011-10-31 19:32:26 -04:00
2015-10-31 19:05:59 -04:00
2015-09-01 19:45:46 -07:00
2012-10-22 16:50:13 -07:00
2011-06-10 14:55:36 +02:00
2012-10-13 10:46:48 +01:00
2015-10-15 13:22:35 +01:00
2012-11-29 03:30:34 -08:00
2015-10-23 17:55:10 +09:00
2015-10-15 16:41:04 +02:00
2015-03-09 13:05:47 +01:00
2015-10-04 12:46:06 +01:00
2015-09-08 15:35:28 -07:00
2014-07-10 18:35:01 +02:00
2013-07-06 14:09:38 -07:00
2014-10-03 14:55:48 -07:00
2014-09-29 00:04:55 -04:00
2015-11-04 21:50:37 -08:00
2015-10-28 12:28:06 +01:00
2015-04-14 16:49:05 -07:00
2014-04-03 16:21:06 -07:00
2013-05-07 18:38:27 -07:00
2012-10-13 10:46:48 +01:00
2015-08-17 12:14:53 -07:00
2015-10-16 08:30:09 +09:00
2015-10-04 11:36:07 +01:00
2015-10-13 10:51:30 -07:00
2015-10-31 16:12:10 -07:00
2014-12-31 13:06:50 -05:00
2014-12-10 17:41:10 -08:00
2015-10-11 04:40:05 -07:00
2014-05-26 14:33:10 +02:00
2014-07-08 15:28:16 -07:00
2012-10-13 10:46:48 +01:00
2014-01-21 23:17:20 -08:00
2009-12-17 10:58:17 -05:00
2013-09-12 10:12:47 -07:00
2015-11-05 23:10:54 -08:00
2015-04-02 14:28:53 +01:00
2012-10-13 10:46:48 +01:00
2015-09-05 20:34:28 -07:00
2014-03-03 11:32:08 +01:00
2015-11-04 18:10:13 -08:00
2015-09-04 16:54:41 -07:00
2015-10-09 07:48:59 -07:00
2015-10-21 14:43:42 -06:00
2015-11-06 17:50:42 -08:00
2015-05-31 11:40:14 +09:00
2013-10-11 17:21:14 +11:00
2013-04-30 10:09:06 +02:00
2012-10-13 10:46:48 +01:00
2015-06-19 15:18:28 +02:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2013-10-13 16:16:28 -07:00
2015-11-04 16:24:33 +01:00
2012-10-13 10:46:48 +01:00
2015-08-24 14:05:19 +02:00
2015-10-13 10:34:46 +02:00
2015-09-24 20:42:37 +02:00
2015-09-23 14:35:58 -07:00
2015-10-23 05:44:28 -07:00
2014-06-02 14:56:01 -07:00
2015-09-29 16:27:47 -07:00
2013-02-11 14:16:26 -05:00
2015-10-09 07:49:05 -07:00
2015-11-05 14:51:32 -08:00
2015-07-05 23:59:14 -04:00
2014-05-14 16:40:04 -07:00
2012-11-10 00:40:24 -08:00
2015-10-15 15:35:32 +01:00
2015-10-27 08:36:08 +09:00
2015-09-22 12:39:57 +02:00
2015-11-04 11:30:57 -08:00
2015-10-22 00:00:49 +02:00
2015-10-16 22:18:51 +02:00
2015-10-04 12:46:06 +01:00
2015-09-03 15:02:28 -05:00
2015-10-05 02:45:25 -07:00
2015-10-11 11:33:42 +02:00
2015-10-01 15:06:43 +02:00
2015-10-01 02:18:38 +02:00
2015-09-16 15:47:51 +02:00
2015-10-13 19:01:25 +02:00
2015-09-16 15:47:51 +02:00
2015-10-30 10:13:26 +01:00
2013-12-07 01:24:33 +01:00
2015-09-03 12:52:19 -07:00
2015-11-05 14:51:32 -08:00
2012-10-13 10:46:48 +01:00
2007-07-31 15:39:40 -07:00
2014-12-13 13:33:07 +01:00
2013-11-13 12:09:07 +09:00
2015-11-06 17:50:42 -08:00
2014-10-14 15:05:34 -04:00
2015-09-10 13:29:01 -07:00
2015-10-21 15:18:36 +01:00
2015-10-21 15:18:36 +01:00
2014-09-09 10:34:56 +02:00
2015-09-10 13:29:01 -07:00
2012-07-21 10:34:00 -07:00
2010-03-15 15:29:39 +01:00
2013-08-28 21:35:14 -07:00
2015-10-04 11:46:16 +01:00
2015-09-04 16:54:41 -07:00
2015-11-04 16:24:36 +01:00
2015-10-01 15:06:46 +02:00
2011-09-16 19:20:20 -04:00
2013-07-03 16:07:43 -07:00
2012-05-29 16:22:32 -07:00
2015-10-26 09:10:56 +01:00
2015-03-24 11:52:08 +10:30
2015-09-30 17:37:55 -04:00
2013-01-06 01:11:25 -08:00
2015-11-03 09:53:24 -07:00
2015-10-06 11:16:42 -07:00
2015-10-06 11:16:42 -07:00
2015-10-06 11:16:42 -07:00
2015-05-19 23:58:43 +02:00
2012-10-13 10:46:48 +01:00
2013-09-11 15:59:45 -07:00
2015-08-10 14:29:27 +05:30
2012-03-16 10:38:24 -04:00
2014-10-24 15:49:20 -04:00
2009-06-09 00:53:21 +04:00
2014-03-18 19:19:41 -04:00
2015-09-20 19:31:10 -07:00
2015-11-05 19:34:48 -08:00
2015-11-05 23:10:54 -08:00
2015-10-23 14:19:58 +01:00
2014-10-22 16:14:04 -06:00
2009-06-16 08:40:20 +02:00
2015-10-04 12:46:06 +01:00
2015-09-09 17:19:14 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2014-10-09 22:25:58 -04:00
2015-09-10 13:29:01 -07:00
2015-11-06 17:50:42 -08:00
2015-09-20 19:30:10 -07:00
2015-07-05 23:59:14 -04:00
2015-03-12 18:46:08 -07:00
2015-11-06 17:50:42 -08:00
2015-04-18 11:20:31 -04:00
2009-04-01 07:38:54 -04:00
2015-10-20 22:10:45 +08:00
2014-01-27 21:02:39 -08:00
2015-10-16 13:07:16 +01:00
2015-10-17 21:11:29 -07:00
2015-05-15 01:10:45 -04:00
2015-10-08 05:26:35 -07:00
2015-11-03 11:29:57 -05:00
2015-11-04 11:30:22 -08:00
2015-09-17 17:18:37 -07:00
2015-09-17 17:18:32 -07:00
2015-09-29 20:21:32 +02:00
2015-09-30 01:45:03 -05:00
2015-10-16 18:45:36 +02:00
2015-09-09 21:43:22 -07:00
2015-09-07 12:36:13 -04:00
2012-10-13 10:46:48 +01:00
2014-01-25 03:14:05 -05:00
2015-11-05 19:34:48 -08:00
2012-12-11 17:22:27 -08:00
2015-09-07 15:17:08 -04:00
2015-09-07 15:17:09 -04:00
2015-10-09 10:40:37 -06:00
2012-10-13 10:46:48 +01:00
2015-10-16 22:49:26 +02:00
2015-10-16 13:07:15 +01:00
2015-08-26 01:46:39 +02:00
2015-10-28 10:05:58 -07:00
2015-10-08 05:26:36 -07:00
2015-09-08 15:35:28 -07:00
2013-03-29 17:54:33 -07:00
2015-11-05 19:34:48 -08:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-11-06 17:50:42 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2014-01-23 16:36:55 -08:00
2012-10-13 10:46:48 +01:00
2014-11-13 10:35:25 -07:00
2015-10-16 22:18:51 +02:00
2015-09-08 15:35:28 -07:00
2014-07-09 14:58:37 +01:00
2014-01-23 20:17:18 +00:00
2015-01-06 10:26:10 -05:00
2015-10-06 11:25:31 -07:00
2015-09-13 11:27:30 +02:00
2015-10-23 05:57:43 -07:00
2015-10-05 05:02:40 +01:00
2015-05-12 23:55:37 +02:00
2015-10-28 04:33:04 +01:00
2015-09-15 02:03:16 +02:00
2015-10-14 02:17:34 +02:00
2015-09-10 13:29:01 -07:00
2015-10-01 09:59:16 -07:00
2015-10-21 14:46:56 -06:00
2015-10-06 17:08:19 +02:00
2015-09-10 13:29:01 -07:00
2015-09-25 02:00:19 +02:00
2015-10-22 08:59:18 -07:00
2011-07-01 15:39:38 -07:00
2015-11-03 11:08:22 -05:00
2015-03-31 12:01:19 -04:00
2014-05-07 10:15:31 +02:00
2015-10-30 11:18:05 +09:00
2010-02-08 18:19:41 -06:00
2015-10-08 05:26:38 -07:00
2014-06-25 11:22:03 -07:00
2014-12-13 12:42:52 -08:00
2012-05-17 15:18:37 +02:00
2015-11-06 17:50:42 -08:00
2015-10-06 11:25:45 -07:00
2015-10-06 11:16:18 -07:00
2015-10-06 11:16:31 -07:00
2015-10-06 11:08:23 -07:00
2015-10-06 11:08:05 -07:00
2015-10-12 19:25:07 +01:00
2012-03-24 10:08:39 -07:00
2014-10-20 10:11:29 +02:00
2011-04-19 15:38:02 -04:00
2012-10-13 10:46:48 +01:00
2014-11-10 16:45:43 -05:00
2015-09-04 16:54:41 -07:00
2006-07-13 13:21:35 -07:00
2012-07-04 11:51:59 +03:00
2007-05-02 11:56:33 +01:00
2015-06-25 01:13:43 +02:00
2015-10-09 07:49:06 -07:00
2014-01-13 13:47:36 +01:00
2012-03-07 11:32:21 +00:00
2014-04-22 13:38:33 -07:00
2015-11-05 23:10:54 -08:00
2015-10-04 12:54:54 +01:00
2015-10-27 19:55:13 -07:00
2012-10-13 10:46:48 +01:00
2015-09-20 17:00:26 -07:00
2013-07-09 10:33:28 -07:00
2015-02-13 21:21:39 -08:00
2015-09-11 15:21:34 -07:00
2015-07-01 10:49:25 -07:00
2015-05-10 19:06:38 +02:00
2014-07-02 16:01:51 +02:00
2014-08-08 15:57:26 -07:00
2015-11-06 17:50:42 -08:00
2015-02-12 18:54:09 -08:00
2015-11-05 19:34:48 -08:00
2015-10-20 10:23:55 +02:00
2015-04-11 15:53:35 -04:00
2015-01-03 14:32:57 -05:00
2015-09-20 19:32:02 -07:00
2015-10-06 11:15:43 -07:00
2008-05-26 16:15:32 +02:00
2015-04-14 09:50:27 -07:00
2006-12-07 02:14:08 +01:00
2012-10-13 10:46:48 +01:00
2010-08-09 16:48:44 -04:00
2015-06-25 17:00:38 -07:00
2015-10-04 20:28:58 +01:00
2015-10-20 10:23:55 +02:00
2015-09-10 13:29:01 -07:00
2015-09-10 15:36:59 -04:00
2009-04-10 15:48:52 +02:00
2015-10-14 02:17:33 +02:00
2015-09-08 15:35:28 -07:00
2015-09-08 15:35:28 -07:00
2014-03-26 16:49:31 -04:00
2005-04-16 15:20:36 -07:00
2015-11-05 19:34:48 -08:00
2015-07-01 10:36:39 -05:00
2015-10-19 01:01:19 +02:00
2013-10-16 13:01:44 -07:00
2010-08-11 08:59:22 -07:00
2015-10-21 14:42:38 -06:00
2012-09-13 16:47:34 +02:00
2015-10-22 06:22:13 -07:00
2015-09-14 07:39:46 -07:00
2015-09-20 22:52:13 -07:00
2015-10-01 09:59:01 -07:00
2015-06-19 15:18:28 +02:00
2014-07-18 11:49:57 +02:00
2015-04-22 17:06:49 +02:00
2015-10-01 09:57:59 -07:00
2010-11-29 08:55:25 +11:00
2015-10-19 01:01:21 +02:00
2015-11-05 19:34:48 -08:00
2015-10-17 21:32:21 -07:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2013-04-19 00:40:07 +02:00
2013-04-15 21:23:03 +01:00
2015-05-14 17:55:51 -07:00
2015-10-04 10:34:17 +01:00
2012-10-13 10:46:48 +01:00
2015-09-04 16:54:41 -07:00
2014-12-04 14:31:00 -05:00
2005-04-16 15:20:36 -07:00
2015-04-15 12:41:14 +09:30
2015-11-05 19:34:48 -08:00
2015-11-01 17:09:15 -08:00
2015-10-17 22:03:00 -07:00
2015-11-05 19:34:48 -08:00
2015-06-01 15:48:54 +02:00
2015-02-02 10:09:54 -08:00
2013-12-02 20:43:15 +01:00
2015-09-22 15:09:53 -07:00
2015-09-04 16:54:41 -07:00
2015-08-17 15:48:24 -04:00
2015-06-02 08:40:20 -06:00
2013-07-25 19:30:03 +10:00
2015-09-08 15:35:28 -07:00
2006-06-22 15:05:58 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00