Aaron Lu
b0cd52e644
mm/swap: use nr_node_ids for avail_lists in swap_info_struct
...
[ Upstream commit 66f71da9dd ]
Since a2468cc9bf ("swap: choose swap device according to numa node"),
avail_lists field of swap_info_struct is changed to an array with
MAX_NUMNODES elements. This made swap_info_struct size increased to 40KiB
and needs an order-4 page to hold it.
This is not optimal in that:
1 Most systems have way less than MAX_NUMNODES(1024) nodes so it
is a waste of memory;
2 It could cause swapon failure if the swap device is swapped on
after system has been running for a while, due to no order-4
page is available as pointed out by Vasily Averin.
Solve the above two issues by using nr_node_ids(which is the actual
possible node number the running system has) for avail_lists instead of
MAX_NUMNODES.
nr_node_ids is unknown at compile time so can't be directly used when
declaring this array. What I did here is to declare avail_lists as zero
element array and allocate space for it when allocating space for
swap_info_struct. The reason why keep using array but not pointer is
plist_for_each_entry needs the field to be part of the struct, so pointer
will not work.
This patch is on top of Vasily Averin's fix commit. I think the use of
kvzalloc for swap_info_struct is still needed in case nr_node_ids is
really big on some systems.
Link: http://lkml.kernel.org/r/20181115083847.GA11129@intel.com
Signed-off-by: Aaron Lu <aaron.lu@intel.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: Michal Hocko <mhocko@suse.com >
Cc: Vasily Averin <vvs@virtuozzo.com >
Cc: Huang Ying <ying.huang@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2019-01-26 09:32:43 +01:00
..
2019-01-22 21:40:33 +01:00
2018-12-01 09:37:29 +01:00
2018-11-21 09:19:16 +01:00
2018-08-18 15:55:59 -07:00
2018-09-30 08:49:55 -07:00
2018-08-05 17:11:49 -07:00
2018-10-10 14:03:27 +02:00
2018-08-22 14:07:56 +02:00
2018-08-09 16:11:21 -04:00
2018-08-03 19:52:14 +05:30
2018-09-10 16:58:36 +01:00
2018-10-10 18:26:16 -07:00
2018-11-27 16:13:05 +01:00
2019-01-13 09:50:57 +01:00
2018-10-12 15:25:17 +01:00
2018-08-26 17:45:25 -07:00
2018-08-09 14:05:30 -07:00
2018-09-03 16:10:40 +01:00
2018-12-05 19:32:02 +01:00
2018-08-23 13:44:43 -07:00
2018-09-28 18:04:06 -07:00
2018-08-09 18:47:47 +03:00
2019-01-16 22:04:37 +01:00
2019-01-26 09:32:34 +01:00
2018-07-23 12:44:52 +02:00
2018-08-22 08:08:27 -07:00
2018-08-30 14:18:03 +01:00
2018-07-30 08:49:02 -04:00
2018-07-25 11:53:59 +02:00
2019-01-26 09:32:34 +01:00
2018-08-22 10:52:46 -07:00
2018-07-24 14:43:26 -06:00
2018-08-17 16:20:27 -07:00
2018-08-01 15:49:40 -07:00
2018-08-22 10:52:48 -07:00
2018-07-18 08:44:22 -06:00
2018-08-31 14:48:56 -06:00
2018-08-14 10:23:25 -07:00
2018-09-11 10:59:53 -06:00
2018-08-02 12:17:27 -06:00
2018-08-11 01:58:46 +02:00
2018-11-13 11:08:14 -08:00
2018-08-03 00:47:32 +02:00
2018-08-13 00:52:45 +02:00
2018-07-21 16:21:25 -07:00
2018-08-07 15:48:38 -07:00
2018-08-02 15:22:13 -06:00
2018-10-04 13:28:08 -07:00
2018-08-13 01:02:39 +02:00
2018-07-19 17:08:52 -07:00
2018-08-17 16:20:32 -07:00
2018-11-13 11:08:25 -08:00
2018-09-20 15:23:58 +02:00
2018-08-22 17:31:34 -07:00
2019-01-16 22:04:29 +01:00
2018-08-22 17:31:34 -07:00
2018-08-22 10:52:47 -07:00
2018-07-21 09:21:10 +02:00
2018-07-31 13:06:57 +02:00
2018-08-14 13:12:24 -07:00
2018-08-23 13:44:43 -07:00
2018-08-13 09:05:05 -07:00
2018-08-22 10:52:46 -07:00
2018-07-27 19:04:33 +08:00
2018-08-22 10:52:48 -07:00
2018-07-18 07:27:22 -04:00
2018-07-23 10:38:06 -07:00
2018-08-21 18:19:09 -07:00
2018-07-26 19:38:03 -07:00
2018-08-18 11:44:53 -07:00
2018-07-31 17:33:21 -04:00
2018-08-17 16:20:32 -07:00
2018-07-31 18:04:55 -05:00
2018-07-25 13:32:58 +02:00
2018-07-30 10:50:22 +05:30
2018-07-22 14:13:43 +02:00
2018-07-26 19:38:03 -07:00
2018-08-25 13:40:38 -07:00
2018-07-28 18:23:26 -07:00
2018-07-24 19:11:26 +02:00
2019-01-26 09:32:34 +01:00
2018-11-13 11:08:50 -08:00
2018-12-17 09:24:38 +01:00
2018-07-27 09:57:23 +10:00
2018-12-01 09:37:31 +01:00
2018-07-18 15:44:44 +02:00
2018-12-05 19:32:10 +01:00
2018-07-23 12:44:52 +02:00
2019-01-22 21:40:35 +01:00
2018-08-23 18:48:43 -07:00
2018-08-02 10:24:51 +02:00
2018-07-18 17:27:10 +00:00
2018-11-13 11:08:54 -08:00
2018-12-05 19:32:13 +01:00
2018-09-04 21:31:43 +02:00
2019-01-13 09:51:04 +01:00
2018-10-18 11:30:52 +02:00
2018-10-05 16:32:04 -07:00
2018-12-13 09:16:22 +01:00
2018-08-30 23:13:15 +02:00
2018-11-21 09:19:20 +01:00
2018-08-26 11:48:42 -07:00
2018-08-15 10:25:26 -07:00
2018-07-29 12:37:06 -07:00
2018-07-21 10:43:12 -05:00
2018-08-22 10:52:47 -07:00
2018-07-18 07:27:22 -04:00
2018-08-08 12:02:27 +02:00
2018-08-08 11:06:20 +02:00
2018-08-22 10:52:52 -07:00
2018-08-10 15:11:25 -04:00
2018-08-16 19:36:55 +02:00
2018-07-26 17:04:37 -07:00
2018-08-17 16:20:30 -07:00
2018-08-26 11:25:21 -07:00
2018-08-22 10:52:46 -07:00
2018-07-20 23:44:35 -07:00
2018-08-18 11:44:53 -07:00
2018-09-20 00:51:43 +02:00
2018-08-24 13:20:33 -07:00
2018-08-17 16:20:32 -07:00
2018-08-10 15:11:25 -04:00
2018-08-15 10:25:26 -07:00
2018-12-29 13:37:59 +01:00
2018-08-02 12:17:28 -06:00
2018-08-22 10:52:45 -07:00
2018-08-22 10:52:45 -07:00
2019-01-13 09:51:04 +01:00
2018-09-13 15:18:04 -10:00
2018-09-13 15:18:04 -10:00
2018-12-29 13:37:57 +01:00
2018-08-22 10:52:44 -07:00
2018-10-09 08:30:51 +02:00
2018-09-05 14:36:53 +02:00
2019-01-16 22:04:29 +01:00
2019-01-09 17:38:42 +01:00
2018-12-05 19:31:59 +01:00
2018-07-31 12:40:22 -07:00
2018-10-10 22:44:46 -07:00
2018-08-03 21:15:09 +02:00
2018-09-28 14:47:40 +02:00
2018-07-24 10:04:49 -07:00
2018-09-23 21:55:24 -07:00
2018-08-23 16:03:58 -07:00
2018-08-09 12:56:39 -04:00
2018-08-13 17:04:23 -04:00
2018-08-09 12:56:39 -04:00
2018-11-21 09:19:20 +01:00
2018-08-17 16:20:29 -07:00
2018-08-22 10:52:45 -07:00
2018-11-13 11:08:24 -08:00
2018-08-31 08:30:42 -04:00
2018-08-03 18:57:15 +05:30
2018-08-23 18:48:44 -07:00
2018-08-08 09:47:26 -06:00
2018-08-17 16:20:28 -07:00
2018-08-23 18:48:43 -07:00
2018-07-23 17:04:13 -05:00
2018-09-03 19:05:13 -07:00
2018-07-31 18:04:55 -05:00
2018-07-19 11:46:45 +01:00
2018-07-19 11:34:23 +01:00
2018-09-11 21:44:52 -05:00
2018-08-22 10:52:45 -07:00
2018-07-25 11:47:02 +02:00
2018-12-01 09:37:34 +01:00
2018-07-25 13:41:22 -07:00
2018-08-09 11:08:19 -07:00
2018-07-21 10:43:12 -05:00
2018-07-31 11:32:27 -04:00
2018-08-14 13:36:15 +02:00
2018-08-22 10:52:46 -07:00
2018-12-17 09:24:39 +01:00
2018-07-20 01:11:45 +02:00
2019-01-09 17:38:33 +01:00
2018-12-05 19:32:03 +01:00
2018-07-21 13:34:09 -05:00
2018-08-22 18:17:29 +02:00
2018-08-02 17:33:06 -04:00
2018-08-09 11:15:06 +01:00
2018-08-01 21:09:50 -04:00
2018-08-02 17:16:05 +02:00
2018-07-25 11:22:19 +02:00
2018-07-20 00:02:43 +02:00
2018-12-05 19:32:10 +01:00
2018-08-15 10:25:26 -07:00
2018-07-21 09:18:27 +02:00
2018-10-02 14:38:02 -07:00
2018-08-20 09:22:45 -07:00
2018-08-22 10:52:43 -07:00
2018-11-13 11:08:45 -08:00
2018-12-17 09:24:27 +01:00
2018-08-17 16:20:30 -07:00
2018-08-16 12:14:42 -07:00
2018-07-26 10:50:16 -04:00
2018-09-18 19:48:08 -07:00
2018-10-12 12:35:02 +02:00
2019-01-26 09:32:43 +01:00
2018-08-23 18:48:44 -07:00
2018-08-14 16:39:13 -07:00
2018-08-18 11:44:53 -07:00
2018-12-29 13:37:55 +01:00
2018-11-13 11:08:51 -08:00
2018-12-05 19:32:00 +01:00
2018-08-22 15:11:35 +02:00
2018-09-03 13:26:44 +02:00
2018-07-28 17:03:11 +03:00
2018-10-17 15:35:29 -04:00
2018-12-08 12:59:07 +01:00
2018-12-13 09:16:15 +01:00
2018-09-12 14:58:47 -07:00
2018-08-13 20:08:33 -04:00
2018-12-13 09:16:15 +01:00
2018-08-23 18:48:44 -07:00
2018-08-16 09:57:20 -07:00
2018-09-13 17:58:30 +02:00
2018-08-11 12:02:18 -07:00
2018-10-04 22:23:15 -07:00
2018-09-13 15:18:04 -10:00
2018-09-13 15:18:04 -10:00
2018-11-13 11:08:42 -08:00