Hugh Dickins
fe19bd3dae
mm, futex: fix shared futex pgoff on shmem huge page
...
If more than one futex is placed on a shmem huge page, it can happen
that waking the second wakes the first instead, and leaves the second
waiting: the key's shared.pgoff is wrong.
When 3.11 commit 13d60f4b6ab5 ("futex: Take hugepages into account when
generating futex_key"), the only shared huge pages came from hugetlbfs,
and the code added to deal with its exceptional page->index was put into
hugetlb source. Then that was missed when 4.8 added shmem huge pages.
page_to_pgoff() is what others use for this nowadays: except that, as
currently written, it gives the right answer on hugetlbfs head, but
nonsense on hugetlbfs tails. Fix that by calling hugetlbfs-specific
hugetlb_basepage_index() on PageHuge tails as well as on head.
Yes, it's unconventional to declare hugetlb_basepage_index() there in
pagemap.h, rather than in hugetlb.h; but I do not expect anything but
page_to_pgoff() ever to need it.
[akpm@linux-foundation.org: give hugetlb_basepage_index() prototype the correct scope]
Link: https://lkml.kernel.org/r/b17d946b-d09-326e-b42a-52884c36df32@google.com
Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
Reported-by: Neel Natu <neelnatu@google.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Zhang Yi <wetpzy@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-24 19:40:54 -07:00
..
2021-04-26 16:32:11 -07:00
2021-06-04 07:37:49 -07:00
2021-04-27 14:10:15 -07:00
2021-04-30 13:04:30 -07:00
2021-04-06 15:33:32 -05:00
2021-05-05 12:39:29 -07:00
2021-04-07 08:36:38 +01:00
2021-04-26 12:30:36 -07:00
2021-06-08 09:41:16 -07:00
2021-06-03 14:19:53 -03:00
2021-06-16 15:36:47 -07:00
2021-04-23 09:29:49 +02:00
2021-04-16 20:30:54 +02:00
2021-04-26 18:16:56 +02:00
2021-05-03 23:04:01 +02:00
2021-04-26 03:20:07 +02:00
2021-04-26 18:16:56 +02:00
2021-04-26 18:16:56 +02:00
2021-04-22 02:03:01 +02:00
2021-05-18 10:11:06 +03:00
2021-04-08 13:26:22 -07:00
2021-04-23 13:18:35 +01:00
2021-05-21 06:12:52 -10:00
2021-04-06 10:22:02 +05:30
2021-05-18 17:24:52 +01:00
2021-05-26 06:36:13 -04:00
2021-05-19 15:24:52 +02:00
2021-06-04 13:24:16 +02:00
2021-04-26 17:04:27 +02:00
2021-05-06 19:24:11 -07:00
2021-04-07 11:14:55 +02:00
2021-06-14 15:55:02 +02:00
2021-04-07 16:33:20 +01:00
2021-04-09 14:54:23 -07:00
2021-04-14 16:30:30 +03:00
2021-05-07 00:26:33 -07:00
2021-05-08 21:49:48 -06:00
2021-05-07 00:34:51 -07:00
2021-05-06 19:24:12 -07:00
2021-05-22 15:09:07 -10:00
2021-04-21 22:59:17 -04:00
2021-05-15 08:52:30 -07:00
2021-05-03 11:56:23 +02:00
2021-04-29 11:57:23 -07:00
2021-05-05 11:27:24 -07:00
2021-04-15 17:04:24 +01:00
2021-04-08 16:04:20 -07:00
2021-05-24 12:45:26 -04:00
2021-05-24 12:45:26 -04:00
2021-04-07 11:05:44 -07:00
2021-04-07 16:33:20 +01:00
2021-05-01 10:14:08 -07:00
2021-05-05 11:27:24 -07:00
2021-05-05 11:27:24 -07:00
2021-05-21 06:12:52 -10:00
2021-05-12 20:18:46 +02:00
2021-04-08 16:04:20 -07:00
2021-04-08 16:04:20 -07:00
2021-04-30 11:20:35 -07:00
2021-04-25 05:26:10 +09:00
2021-05-07 00:26:34 -07:00
2021-05-13 11:00:18 -07:00
2021-05-22 15:09:07 -10:00
2021-05-05 22:54:12 +02:00
2021-04-06 16:05:38 -06:00
2021-05-04 11:24:46 -07:00
2021-04-07 19:26:44 +02:00
2021-04-29 11:41:43 -07:00
2021-05-06 19:24:12 -07:00
2021-05-06 19:24:11 -07:00
2021-04-15 22:36:45 -04:00
2021-06-22 13:56:43 +02:00
2021-04-16 17:06:34 +02:00
2021-05-07 00:26:32 -07:00
2021-04-19 13:13:26 -04:00
2021-05-21 22:12:09 +02:00
2021-04-22 08:20:15 +02:00
2021-04-08 12:21:13 +02:00
2021-04-07 10:30:47 +02:00
2021-05-13 20:50:23 +02:00
2021-05-11 08:12:14 -06:00
2021-04-25 05:25:42 +09:00
2021-05-31 10:14:49 +02:00
2021-04-16 16:59:20 -07:00
2021-05-25 12:21:14 +02:00
2021-06-01 17:38:40 +02:00
2021-04-16 00:13:04 -04:00
2021-04-12 15:04:23 +02:00
2021-04-08 19:12:20 +02:00
2021-05-07 00:26:34 -07:00
2021-04-23 10:14:32 +01:00
2021-04-23 10:14:32 +01:00
2021-05-10 16:22:27 +02:00
2021-05-20 07:59:35 -06:00
2021-05-07 00:26:34 -07:00
2021-05-07 00:26:34 -07:00
2021-05-07 00:26:33 -07:00
2021-05-05 15:52:34 +02:00
2021-05-05 11:27:27 -07:00
2021-05-17 12:31:05 +02:00
2021-06-16 09:24:42 -07:00
2021-06-24 19:40:54 -07:00
2021-04-28 17:22:10 -07:00
2021-04-10 21:59:21 +02:00
2021-04-19 12:50:15 +02:00
2021-05-06 19:24:11 -07:00
2021-05-24 15:24:33 -07:00
2021-05-07 00:26:33 -07:00
2021-04-08 19:09:02 +02:00
2021-04-07 11:55:47 +02:00
2021-04-07 10:15:19 +02:00
2021-04-11 19:30:41 -06:00
2021-04-30 11:20:39 -07:00
2021-04-07 10:56:53 +02:00
2021-04-30 11:20:40 -07:00
2021-05-04 08:54:29 -07:00
2021-04-16 17:20:45 +02:00
2021-04-26 15:03:23 -07:00
2021-04-07 10:30:47 +02:00
2021-04-26 10:25:03 -07:00
2021-05-05 12:39:29 -07:00
2021-04-05 22:39:38 -04:00
2021-04-08 14:05:19 +02:00
2021-04-30 11:20:41 -07:00
2021-05-09 00:29:45 +09:00
2021-05-08 10:00:11 -07:00
2021-06-09 01:49:13 -04:00
2021-05-12 12:37:14 -07:00
2021-04-13 09:16:12 -06:00
2021-04-08 16:04:22 -07:00
2021-04-28 12:37:53 -07:00
2021-05-01 18:50:44 -07:00
2021-05-01 18:50:44 -07:00
2021-04-20 16:27:54 -07:00
2021-04-12 10:36:00 -06:00
2021-04-27 14:13:24 -07:00
2021-05-05 11:27:23 -07:00
2021-05-05 11:27:26 -07:00
2021-05-05 11:27:26 -07:00
2021-05-05 11:27:26 -07:00
2021-04-09 18:48:22 +05:30
2021-05-05 11:27:26 -07:00
2021-05-22 15:09:07 -10:00
2021-04-04 18:29:37 -04:00
2021-06-12 13:28:50 -07:00
2021-06-16 09:24:42 -07:00
2021-05-07 00:26:33 -07:00
2021-04-08 16:04:20 -07:00
2021-04-09 14:54:23 -07:00
2021-04-20 14:11:22 +01:00
2021-04-08 22:18:36 -07:00
2021-04-07 14:43:28 -07:00
2021-04-23 10:14:32 +01:00
2021-04-19 15:41:28 -07:00
2021-04-13 10:04:05 -04:00
2021-05-07 11:23:41 -07:00
2021-04-13 09:41:16 -04:00
2021-04-13 10:04:05 -04:00
2021-04-06 08:34:39 +02:00
2021-04-13 14:35:02 -07:00
2021-04-21 10:24:41 -05:00
2021-04-26 08:51:23 -07:00
2021-04-30 11:20:42 -07:00
2021-06-24 19:40:54 -07:00
2021-04-30 11:20:41 -07:00
2021-04-16 11:34:17 -05:00
2021-05-25 18:37:37 -05:00
2021-05-01 10:14:08 -07:00
2021-06-05 08:58:11 -07:00
2021-05-26 13:15:55 -07:00
2021-04-08 19:14:46 +02:00
2021-05-10 19:14:01 +02:00
2021-04-28 15:43:58 -07:00
2021-05-06 19:24:11 -07:00
2021-05-06 19:24:11 -07:00
2021-04-05 13:18:22 +02:00
2021-04-21 12:20:04 -04:00
2021-06-15 10:59:46 -07:00
2021-04-07 16:33:07 +01:00
2021-04-09 14:17:03 +02:00
2021-04-12 14:49:31 +02:00
2021-05-11 09:56:11 +02:00
2021-04-28 12:00:13 -07:00
2021-05-05 13:24:11 -07:00
2021-06-16 09:24:42 -07:00
2021-06-09 19:10:22 +02:00
2021-06-03 15:47:23 +02:00
2021-05-01 18:50:44 -07:00
2021-04-27 15:50:15 -07:00
2021-04-22 12:04:26 +02:00
2021-04-11 16:34:56 -07:00
2021-05-05 11:27:23 -07:00
2021-05-21 06:12:52 -10:00
2021-04-25 18:02:32 -07:00
2021-05-09 13:07:03 -07:00
2021-06-12 13:13:08 -07:00
2021-04-19 16:03:15 +02:00
2021-04-28 12:37:53 -07:00
2021-04-22 15:02:40 -07:00
2021-05-06 19:24:11 -07:00
2021-06-16 09:24:42 -07:00
2021-05-01 18:50:44 -07:00
2021-04-11 19:30:25 -06:00
2021-04-22 13:14:09 +02:00
2021-05-31 10:14:49 +02:00
2021-04-16 21:03:50 +02:00
2021-04-07 16:33:20 +01:00
2021-04-14 16:30:30 +03:00
2021-04-10 10:36:34 +02:00
2021-04-15 10:32:17 +02:00
2021-04-26 22:55:12 +01:00
2021-04-09 16:00:00 +02:00
2021-04-29 11:06:13 -07:00
2021-05-05 11:27:22 -07:00
2021-05-03 04:55:53 -04:00
2021-04-06 11:55:11 -06:00
2021-04-06 16:17:57 -07:00
2021-05-04 04:19:59 -04:00
2021-05-05 11:27:25 -07:00
2021-06-24 19:40:53 -07:00
2021-04-30 11:20:37 -07:00
2021-05-03 04:55:53 -04:00
2021-05-05 22:54:11 +02:00
2021-04-16 15:31:02 -07:00