aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_xarray.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-12-28 23:20:44 -0500
committerMatthew Wilcox <willy@infradead.org>2019-01-06 22:12:57 -0500
commit76b4e52995654af260f14558e0e07b5b039ae202 (patch)
tree81abacc99a4a81505775c391a8be070925f1c88b /lib/test_xarray.c
parent4a31896c5b5a2715ecf4033426aa0a35066d92d6 (diff)
XArray: Permit storing 2-byte-aligned pointers
On m68k, statically allocated pointers may only be two-byte aligned. This clashes with the XArray's method for tagging internal pointers. Permit storing these pointers in single slots (ie not in multislots). Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r--lib/test_xarray.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index dc02eff562b8..6e0212a60b08 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -1184,6 +1184,35 @@ static noinline void check_store_range(struct xarray *xa)
1184 } 1184 }
1185} 1185}
1186 1186
1187static void check_align_1(struct xarray *xa, char *name)
1188{
1189 int i;
1190 unsigned int id;
1191 unsigned long index;
1192 void *entry;
1193
1194 for (i = 0; i < 8; i++) {
1195 id = 0;
1196 XA_BUG_ON(xa, xa_alloc(xa, &id, UINT_MAX, name + i, GFP_KERNEL)
1197 != 0);
1198 XA_BUG_ON(xa, id != i);
1199 }
1200 xa_for_each(xa, index, entry)
1201 XA_BUG_ON(xa, xa_is_err(entry));
1202 xa_destroy(xa);
1203}
1204
1205static noinline void check_align(struct xarray *xa)
1206{
1207 char name[] = "Motorola 68000";
1208
1209 check_align_1(xa, name);
1210 check_align_1(xa, name + 1);
1211 check_align_1(xa, name + 2);
1212 check_align_1(xa, name + 3);
1213// check_align_2(xa, name);
1214}
1215
1187static LIST_HEAD(shadow_nodes); 1216static LIST_HEAD(shadow_nodes);
1188 1217
1189static void test_update_node(struct xa_node *node) 1218static void test_update_node(struct xa_node *node)
@@ -1333,6 +1362,7 @@ static int xarray_checks(void)
1333 check_create_range(&array); 1362 check_create_range(&array);
1334 check_store_range(&array); 1363 check_store_range(&array);
1335 check_store_iter(&array); 1364 check_store_iter(&array);
1365 check_align(&xa0);
1336 1366
1337 check_workingset(&array, 0); 1367 check_workingset(&array, 0);
1338 check_workingset(&array, 64); 1368 check_workingset(&array, 64);