test_lru_map.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /*
  2. * Copyright (c) 2016 Facebook
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of version 2 of the GNU General Public
  6. * License as published by the Free Software Foundation.
  7. */
  8. #define _GNU_SOURCE
  9. #include <stdio.h>
  10. #include <unistd.h>
  11. #include <errno.h>
  12. #include <string.h>
  13. #include <assert.h>
  14. #include <sched.h>
  15. #include <stdlib.h>
  16. #include <time.h>
  17. #include <sys/wait.h>
  18. #include <bpf/bpf.h>
  19. #include "bpf_util.h"
  20. #include "bpf_rlimit.h"
  21. #define LOCAL_FREE_TARGET (128)
  22. #define PERCPU_FREE_TARGET (4)
  23. static int nr_cpus;
  24. static int create_map(int map_type, int map_flags, unsigned int size)
  25. {
  26. int map_fd;
  27. map_fd = bpf_create_map(map_type, sizeof(unsigned long long),
  28. sizeof(unsigned long long), size, map_flags);
  29. if (map_fd == -1)
  30. perror("bpf_create_map");
  31. return map_fd;
  32. }
  33. static int map_subset(int map0, int map1)
  34. {
  35. unsigned long long next_key = 0;
  36. unsigned long long value0[nr_cpus], value1[nr_cpus];
  37. int ret;
  38. while (!bpf_map_get_next_key(map1, &next_key, &next_key)) {
  39. assert(!bpf_map_lookup_elem(map1, &next_key, value1));
  40. ret = bpf_map_lookup_elem(map0, &next_key, value0);
  41. if (ret) {
  42. printf("key:%llu not found from map. %s(%d)\n",
  43. next_key, strerror(errno), errno);
  44. return 0;
  45. }
  46. if (value0[0] != value1[0]) {
  47. printf("key:%llu value0:%llu != value1:%llu\n",
  48. next_key, value0[0], value1[0]);
  49. return 0;
  50. }
  51. }
  52. return 1;
  53. }
  54. static int map_equal(int lru_map, int expected)
  55. {
  56. return map_subset(lru_map, expected) && map_subset(expected, lru_map);
  57. }
  58. static int sched_next_online(int pid, int *next_to_try)
  59. {
  60. cpu_set_t cpuset;
  61. int next = *next_to_try;
  62. int ret = -1;
  63. while (next < nr_cpus) {
  64. CPU_ZERO(&cpuset);
  65. CPU_SET(next++, &cpuset);
  66. if (!sched_setaffinity(pid, sizeof(cpuset), &cpuset)) {
  67. ret = 0;
  68. break;
  69. }
  70. }
  71. *next_to_try = next;
  72. return ret;
  73. }
  74. /* Size of the LRU amp is 2
  75. * Add key=1 (+1 key)
  76. * Add key=2 (+1 key)
  77. * Lookup Key=1
  78. * Add Key=3
  79. * => Key=2 will be removed by LRU
  80. * Iterate map. Only found key=1 and key=3
  81. */
  82. static void test_lru_sanity0(int map_type, int map_flags)
  83. {
  84. unsigned long long key, value[nr_cpus];
  85. int lru_map_fd, expected_map_fd;
  86. int next_cpu = 0;
  87. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  88. map_flags);
  89. assert(sched_next_online(0, &next_cpu) != -1);
  90. if (map_flags & BPF_F_NO_COMMON_LRU)
  91. lru_map_fd = create_map(map_type, map_flags, 2 * nr_cpus);
  92. else
  93. lru_map_fd = create_map(map_type, map_flags, 2);
  94. assert(lru_map_fd != -1);
  95. expected_map_fd = create_map(BPF_MAP_TYPE_HASH, 0, 2);
  96. assert(expected_map_fd != -1);
  97. value[0] = 1234;
  98. /* insert key=1 element */
  99. key = 1;
  100. assert(!bpf_map_update_elem(lru_map_fd, &key, value, BPF_NOEXIST));
  101. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  102. BPF_NOEXIST));
  103. /* BPF_NOEXIST means: add new element if it doesn't exist */
  104. assert(bpf_map_update_elem(lru_map_fd, &key, value, BPF_NOEXIST) == -1
  105. /* key=1 already exists */
  106. && errno == EEXIST);
  107. assert(bpf_map_update_elem(lru_map_fd, &key, value, -1) == -1 &&
  108. errno == EINVAL);
  109. /* insert key=2 element */
  110. /* check that key=2 is not found */
  111. key = 2;
  112. assert(bpf_map_lookup_elem(lru_map_fd, &key, value) == -1 &&
  113. errno == ENOENT);
  114. /* BPF_EXIST means: update existing element */
  115. assert(bpf_map_update_elem(lru_map_fd, &key, value, BPF_EXIST) == -1 &&
  116. /* key=2 is not there */
  117. errno == ENOENT);
  118. assert(!bpf_map_update_elem(lru_map_fd, &key, value, BPF_NOEXIST));
  119. /* insert key=3 element */
  120. /* check that key=3 is not found */
  121. key = 3;
  122. assert(bpf_map_lookup_elem(lru_map_fd, &key, value) == -1 &&
  123. errno == ENOENT);
  124. /* check that key=1 can be found and mark the ref bit to
  125. * stop LRU from removing key=1
  126. */
  127. key = 1;
  128. assert(!bpf_map_lookup_elem(lru_map_fd, &key, value));
  129. assert(value[0] == 1234);
  130. key = 3;
  131. assert(!bpf_map_update_elem(lru_map_fd, &key, value, BPF_NOEXIST));
  132. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  133. BPF_NOEXIST));
  134. /* key=2 has been removed from the LRU */
  135. key = 2;
  136. assert(bpf_map_lookup_elem(lru_map_fd, &key, value) == -1);
  137. assert(map_equal(lru_map_fd, expected_map_fd));
  138. close(expected_map_fd);
  139. close(lru_map_fd);
  140. printf("Pass\n");
  141. }
  142. /* Size of the LRU map is 1.5*tgt_free
  143. * Insert 1 to tgt_free (+tgt_free keys)
  144. * Lookup 1 to tgt_free/2
  145. * Insert 1+tgt_free to 2*tgt_free (+tgt_free keys)
  146. * => 1+tgt_free/2 to LOCALFREE_TARGET will be removed by LRU
  147. */
  148. static void test_lru_sanity1(int map_type, int map_flags, unsigned int tgt_free)
  149. {
  150. unsigned long long key, end_key, value[nr_cpus];
  151. int lru_map_fd, expected_map_fd;
  152. unsigned int batch_size;
  153. unsigned int map_size;
  154. int next_cpu = 0;
  155. if (map_flags & BPF_F_NO_COMMON_LRU)
  156. /* This test is only applicable to common LRU list */
  157. return;
  158. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  159. map_flags);
  160. assert(sched_next_online(0, &next_cpu) != -1);
  161. batch_size = tgt_free / 2;
  162. assert(batch_size * 2 == tgt_free);
  163. map_size = tgt_free + batch_size;
  164. lru_map_fd = create_map(map_type, map_flags, map_size);
  165. assert(lru_map_fd != -1);
  166. expected_map_fd = create_map(BPF_MAP_TYPE_HASH, 0, map_size);
  167. assert(expected_map_fd != -1);
  168. value[0] = 1234;
  169. /* Insert 1 to tgt_free (+tgt_free keys) */
  170. end_key = 1 + tgt_free;
  171. for (key = 1; key < end_key; key++)
  172. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  173. BPF_NOEXIST));
  174. /* Lookup 1 to tgt_free/2 */
  175. end_key = 1 + batch_size;
  176. for (key = 1; key < end_key; key++) {
  177. assert(!bpf_map_lookup_elem(lru_map_fd, &key, value));
  178. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  179. BPF_NOEXIST));
  180. }
  181. /* Insert 1+tgt_free to 2*tgt_free
  182. * => 1+tgt_free/2 to LOCALFREE_TARGET will be
  183. * removed by LRU
  184. */
  185. key = 1 + tgt_free;
  186. end_key = key + tgt_free;
  187. for (; key < end_key; key++) {
  188. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  189. BPF_NOEXIST));
  190. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  191. BPF_NOEXIST));
  192. }
  193. assert(map_equal(lru_map_fd, expected_map_fd));
  194. close(expected_map_fd);
  195. close(lru_map_fd);
  196. printf("Pass\n");
  197. }
  198. /* Size of the LRU map 1.5 * tgt_free
  199. * Insert 1 to tgt_free (+tgt_free keys)
  200. * Update 1 to tgt_free/2
  201. * => The original 1 to tgt_free/2 will be removed due to
  202. * the LRU shrink process
  203. * Re-insert 1 to tgt_free/2 again and do a lookup immeidately
  204. * Insert 1+tgt_free to tgt_free*3/2
  205. * Insert 1+tgt_free*3/2 to tgt_free*5/2
  206. * => Key 1+tgt_free to tgt_free*3/2
  207. * will be removed from LRU because it has never
  208. * been lookup and ref bit is not set
  209. */
  210. static void test_lru_sanity2(int map_type, int map_flags, unsigned int tgt_free)
  211. {
  212. unsigned long long key, value[nr_cpus];
  213. unsigned long long end_key;
  214. int lru_map_fd, expected_map_fd;
  215. unsigned int batch_size;
  216. unsigned int map_size;
  217. int next_cpu = 0;
  218. if (map_flags & BPF_F_NO_COMMON_LRU)
  219. /* This test is only applicable to common LRU list */
  220. return;
  221. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  222. map_flags);
  223. assert(sched_next_online(0, &next_cpu) != -1);
  224. batch_size = tgt_free / 2;
  225. assert(batch_size * 2 == tgt_free);
  226. map_size = tgt_free + batch_size;
  227. lru_map_fd = create_map(map_type, map_flags, map_size);
  228. assert(lru_map_fd != -1);
  229. expected_map_fd = create_map(BPF_MAP_TYPE_HASH, 0, map_size);
  230. assert(expected_map_fd != -1);
  231. value[0] = 1234;
  232. /* Insert 1 to tgt_free (+tgt_free keys) */
  233. end_key = 1 + tgt_free;
  234. for (key = 1; key < end_key; key++)
  235. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  236. BPF_NOEXIST));
  237. /* Any bpf_map_update_elem will require to acquire a new node
  238. * from LRU first.
  239. *
  240. * The local list is running out of free nodes.
  241. * It gets from the global LRU list which tries to
  242. * shrink the inactive list to get tgt_free
  243. * number of free nodes.
  244. *
  245. * Hence, the oldest key 1 to tgt_free/2
  246. * are removed from the LRU list.
  247. */
  248. key = 1;
  249. if (map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH) {
  250. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  251. BPF_NOEXIST));
  252. assert(!bpf_map_delete_elem(lru_map_fd, &key));
  253. } else {
  254. assert(bpf_map_update_elem(lru_map_fd, &key, value,
  255. BPF_EXIST));
  256. }
  257. /* Re-insert 1 to tgt_free/2 again and do a lookup
  258. * immeidately.
  259. */
  260. end_key = 1 + batch_size;
  261. value[0] = 4321;
  262. for (key = 1; key < end_key; key++) {
  263. assert(bpf_map_lookup_elem(lru_map_fd, &key, value));
  264. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  265. BPF_NOEXIST));
  266. assert(!bpf_map_lookup_elem(lru_map_fd, &key, value));
  267. assert(value[0] == 4321);
  268. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  269. BPF_NOEXIST));
  270. }
  271. value[0] = 1234;
  272. /* Insert 1+tgt_free to tgt_free*3/2 */
  273. end_key = 1 + tgt_free + batch_size;
  274. for (key = 1 + tgt_free; key < end_key; key++)
  275. /* These newly added but not referenced keys will be
  276. * gone during the next LRU shrink.
  277. */
  278. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  279. BPF_NOEXIST));
  280. /* Insert 1+tgt_free*3/2 to tgt_free*5/2 */
  281. end_key = key + tgt_free;
  282. for (; key < end_key; key++) {
  283. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  284. BPF_NOEXIST));
  285. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  286. BPF_NOEXIST));
  287. }
  288. assert(map_equal(lru_map_fd, expected_map_fd));
  289. close(expected_map_fd);
  290. close(lru_map_fd);
  291. printf("Pass\n");
  292. }
  293. /* Size of the LRU map is 2*tgt_free
  294. * It is to test the active/inactive list rotation
  295. * Insert 1 to 2*tgt_free (+2*tgt_free keys)
  296. * Lookup key 1 to tgt_free*3/2
  297. * Add 1+2*tgt_free to tgt_free*5/2 (+tgt_free/2 keys)
  298. * => key 1+tgt_free*3/2 to 2*tgt_free are removed from LRU
  299. */
  300. static void test_lru_sanity3(int map_type, int map_flags, unsigned int tgt_free)
  301. {
  302. unsigned long long key, end_key, value[nr_cpus];
  303. int lru_map_fd, expected_map_fd;
  304. unsigned int batch_size;
  305. unsigned int map_size;
  306. int next_cpu = 0;
  307. if (map_flags & BPF_F_NO_COMMON_LRU)
  308. /* This test is only applicable to common LRU list */
  309. return;
  310. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  311. map_flags);
  312. assert(sched_next_online(0, &next_cpu) != -1);
  313. batch_size = tgt_free / 2;
  314. assert(batch_size * 2 == tgt_free);
  315. map_size = tgt_free * 2;
  316. lru_map_fd = create_map(map_type, map_flags, map_size);
  317. assert(lru_map_fd != -1);
  318. expected_map_fd = create_map(BPF_MAP_TYPE_HASH, 0, map_size);
  319. assert(expected_map_fd != -1);
  320. value[0] = 1234;
  321. /* Insert 1 to 2*tgt_free (+2*tgt_free keys) */
  322. end_key = 1 + (2 * tgt_free);
  323. for (key = 1; key < end_key; key++)
  324. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  325. BPF_NOEXIST));
  326. /* Lookup key 1 to tgt_free*3/2 */
  327. end_key = tgt_free + batch_size;
  328. for (key = 1; key < end_key; key++) {
  329. assert(!bpf_map_lookup_elem(lru_map_fd, &key, value));
  330. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  331. BPF_NOEXIST));
  332. }
  333. /* Add 1+2*tgt_free to tgt_free*5/2
  334. * (+tgt_free/2 keys)
  335. */
  336. key = 2 * tgt_free + 1;
  337. end_key = key + batch_size;
  338. for (; key < end_key; key++) {
  339. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  340. BPF_NOEXIST));
  341. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  342. BPF_NOEXIST));
  343. }
  344. assert(map_equal(lru_map_fd, expected_map_fd));
  345. close(expected_map_fd);
  346. close(lru_map_fd);
  347. printf("Pass\n");
  348. }
  349. /* Test deletion */
  350. static void test_lru_sanity4(int map_type, int map_flags, unsigned int tgt_free)
  351. {
  352. int lru_map_fd, expected_map_fd;
  353. unsigned long long key, value[nr_cpus];
  354. unsigned long long end_key;
  355. int next_cpu = 0;
  356. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  357. map_flags);
  358. assert(sched_next_online(0, &next_cpu) != -1);
  359. if (map_flags & BPF_F_NO_COMMON_LRU)
  360. lru_map_fd = create_map(map_type, map_flags,
  361. 3 * tgt_free * nr_cpus);
  362. else
  363. lru_map_fd = create_map(map_type, map_flags, 3 * tgt_free);
  364. assert(lru_map_fd != -1);
  365. expected_map_fd = create_map(BPF_MAP_TYPE_HASH, 0,
  366. 3 * tgt_free);
  367. assert(expected_map_fd != -1);
  368. value[0] = 1234;
  369. for (key = 1; key <= 2 * tgt_free; key++)
  370. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  371. BPF_NOEXIST));
  372. key = 1;
  373. assert(bpf_map_update_elem(lru_map_fd, &key, value, BPF_NOEXIST));
  374. for (key = 1; key <= tgt_free; key++) {
  375. assert(!bpf_map_lookup_elem(lru_map_fd, &key, value));
  376. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  377. BPF_NOEXIST));
  378. }
  379. for (; key <= 2 * tgt_free; key++) {
  380. assert(!bpf_map_delete_elem(lru_map_fd, &key));
  381. assert(bpf_map_delete_elem(lru_map_fd, &key));
  382. }
  383. end_key = key + 2 * tgt_free;
  384. for (; key < end_key; key++) {
  385. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  386. BPF_NOEXIST));
  387. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  388. BPF_NOEXIST));
  389. }
  390. assert(map_equal(lru_map_fd, expected_map_fd));
  391. close(expected_map_fd);
  392. close(lru_map_fd);
  393. printf("Pass\n");
  394. }
  395. static void do_test_lru_sanity5(unsigned long long last_key, int map_fd)
  396. {
  397. unsigned long long key, value[nr_cpus];
  398. /* Ensure the last key inserted by previous CPU can be found */
  399. assert(!bpf_map_lookup_elem(map_fd, &last_key, value));
  400. value[0] = 1234;
  401. key = last_key + 1;
  402. assert(!bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST));
  403. assert(!bpf_map_lookup_elem(map_fd, &key, value));
  404. /* Cannot find the last key because it was removed by LRU */
  405. assert(bpf_map_lookup_elem(map_fd, &last_key, value));
  406. }
  407. /* Test map with only one element */
  408. static void test_lru_sanity5(int map_type, int map_flags)
  409. {
  410. unsigned long long key, value[nr_cpus];
  411. int next_cpu = 0;
  412. int map_fd;
  413. if (map_flags & BPF_F_NO_COMMON_LRU)
  414. return;
  415. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  416. map_flags);
  417. map_fd = create_map(map_type, map_flags, 1);
  418. assert(map_fd != -1);
  419. value[0] = 1234;
  420. key = 0;
  421. assert(!bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST));
  422. while (sched_next_online(0, &next_cpu) != -1) {
  423. pid_t pid;
  424. pid = fork();
  425. if (pid == 0) {
  426. do_test_lru_sanity5(key, map_fd);
  427. exit(0);
  428. } else if (pid == -1) {
  429. printf("couldn't spawn process to test key:%llu\n",
  430. key);
  431. exit(1);
  432. } else {
  433. int status;
  434. assert(waitpid(pid, &status, 0) == pid);
  435. assert(status == 0);
  436. key++;
  437. }
  438. }
  439. close(map_fd);
  440. /* At least one key should be tested */
  441. assert(key > 0);
  442. printf("Pass\n");
  443. }
  444. /* Test list rotation for BPF_F_NO_COMMON_LRU map */
  445. static void test_lru_sanity6(int map_type, int map_flags, int tgt_free)
  446. {
  447. int lru_map_fd, expected_map_fd;
  448. unsigned long long key, value[nr_cpus];
  449. unsigned int map_size = tgt_free * 2;
  450. int next_cpu = 0;
  451. if (!(map_flags & BPF_F_NO_COMMON_LRU))
  452. return;
  453. printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type,
  454. map_flags);
  455. assert(sched_next_online(0, &next_cpu) != -1);
  456. expected_map_fd = create_map(BPF_MAP_TYPE_HASH, 0, map_size);
  457. assert(expected_map_fd != -1);
  458. lru_map_fd = create_map(map_type, map_flags, map_size * nr_cpus);
  459. assert(lru_map_fd != -1);
  460. value[0] = 1234;
  461. for (key = 1; key <= tgt_free; key++) {
  462. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  463. BPF_NOEXIST));
  464. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  465. BPF_NOEXIST));
  466. }
  467. for (; key <= tgt_free * 2; key++) {
  468. unsigned long long stable_key;
  469. /* Make ref bit sticky for key: [1, tgt_free] */
  470. for (stable_key = 1; stable_key <= tgt_free; stable_key++) {
  471. /* Mark the ref bit */
  472. assert(!bpf_map_lookup_elem(lru_map_fd, &stable_key,
  473. value));
  474. }
  475. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  476. BPF_NOEXIST));
  477. }
  478. for (; key <= tgt_free * 3; key++) {
  479. assert(!bpf_map_update_elem(lru_map_fd, &key, value,
  480. BPF_NOEXIST));
  481. assert(!bpf_map_update_elem(expected_map_fd, &key, value,
  482. BPF_NOEXIST));
  483. }
  484. assert(map_equal(lru_map_fd, expected_map_fd));
  485. close(expected_map_fd);
  486. close(lru_map_fd);
  487. printf("Pass\n");
  488. }
  489. int main(int argc, char **argv)
  490. {
  491. int map_types[] = {BPF_MAP_TYPE_LRU_HASH,
  492. BPF_MAP_TYPE_LRU_PERCPU_HASH};
  493. int map_flags[] = {0, BPF_F_NO_COMMON_LRU};
  494. int t, f;
  495. setbuf(stdout, NULL);
  496. nr_cpus = bpf_num_possible_cpus();
  497. assert(nr_cpus != -1);
  498. printf("nr_cpus:%d\n\n", nr_cpus);
  499. for (f = 0; f < sizeof(map_flags) / sizeof(*map_flags); f++) {
  500. unsigned int tgt_free = (map_flags[f] & BPF_F_NO_COMMON_LRU) ?
  501. PERCPU_FREE_TARGET : LOCAL_FREE_TARGET;
  502. for (t = 0; t < sizeof(map_types) / sizeof(*map_types); t++) {
  503. test_lru_sanity0(map_types[t], map_flags[f]);
  504. test_lru_sanity1(map_types[t], map_flags[f], tgt_free);
  505. test_lru_sanity2(map_types[t], map_flags[f], tgt_free);
  506. test_lru_sanity3(map_types[t], map_flags[f], tgt_free);
  507. test_lru_sanity4(map_types[t], map_flags[f], tgt_free);
  508. test_lru_sanity5(map_types[t], map_flags[f]);
  509. test_lru_sanity6(map_types[t], map_flags[f], tgt_free);
  510. printf("\n");
  511. }
  512. }
  513. return 0;
  514. }