git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: remove incorrect limitation on AESNI-MB PMD
[dpdk.git]
/
lib
/
librte_eal
/
linuxapp
/
eal
/
eal_hugepage_info.c
diff --git
a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index
f097e71
..
7a21e8f
100644
(file)
--- a/
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@
-189,15
+189,6
@@
get_hugepage_dir(uint64_t hugepage_sz)
return retval;
}
return retval;
}
-static inline void
-swap_hpi(struct hugepage_info *a, struct hugepage_info *b)
-{
- char buf[sizeof(*a)];
- memcpy(buf, a, sizeof(buf));
- memcpy(a, b, sizeof(buf));
- memcpy(b, buf, sizeof(buf));
-}
-
/*
* Clear the hugepage directory of whatever hugepage files
* there are. Checks if the file is locked (i.e.
/*
* Clear the hugepage directory of whatever hugepage files
* there are. Checks if the file is locked (i.e.
@@
-214,7
+205,7
@@
clear_hugedir(const char * hugedir)
/* open directory */
dir = opendir(hugedir);
if (!dir) {
/* open directory */
dir = opendir(hugedir);
if (!dir) {
- RTE_LOG(
INFO
, EAL, "Unable to open hugepage directory %s\n",
+ RTE_LOG(
ERR
, EAL, "Unable to open hugepage directory %s\n",
hugedir);
goto error;
}
hugedir);
goto error;
}
@@
-222,7
+213,7
@@
clear_hugedir(const char * hugedir)
dirent = readdir(dir);
if (!dirent) {
dirent = readdir(dir);
if (!dirent) {
- RTE_LOG(
INFO
, EAL, "Unable to read hugepage directory %s\n",
+ RTE_LOG(
ERR
, EAL, "Unable to read hugepage directory %s\n",
hugedir);
goto error;
}
hugedir);
goto error;
}
@@
-262,12
+253,21
@@
error:
if (dir)
closedir(dir);
if (dir)
closedir(dir);
- RTE_LOG(
INFO
, EAL, "Error while clearing hugepage dir: %s\n",
+ RTE_LOG(
ERR
, EAL, "Error while clearing hugepage dir: %s\n",
strerror(errno));
return -1;
}
strerror(errno));
return -1;
}
+static int
+compare_hpi(const void *a, const void *b)
+{
+ const struct hugepage_info *hpi_a = a;
+ const struct hugepage_info *hpi_b = b;
+
+ return hpi_b->hugepage_sz - hpi_a->hugepage_sz;
+}
+
/*
* when we initialize the hugepage info, everything goes
* to socket 0 by default. it will later get sorted by memory
/*
* when we initialize the hugepage info, everything goes
* to socket 0 by default. it will later get sorted by memory
@@
-283,9
+283,12
@@
eal_hugepage_info_init(void)
struct dirent *dirent;
dir = opendir(sys_dir_path);
struct dirent *dirent;
dir = opendir(sys_dir_path);
- if (dir == NULL)
- rte_panic("Cannot open directory %s to read system hugepage "
- "info\n", sys_dir_path);
+ if (dir == NULL) {
+ RTE_LOG(ERR, EAL,
+ "Cannot open directory %s to read system hugepage info\n",
+ sys_dir_path);
+ return -1;
+ }
for (dirent = readdir(dir); dirent != NULL; dirent = readdir(dir)) {
struct hugepage_info *hpi;
for (dirent = readdir(dir); dirent != NULL; dirent = readdir(dir)) {
struct hugepage_info *hpi;
@@
-294,6
+297,9
@@
eal_hugepage_info_init(void)
dirent_start_len) != 0)
continue;
dirent_start_len) != 0)
continue;
+ if (num_sizes >= MAX_HUGEPAGE_SIZES)
+ break;
+
hpi = &internal_config.hugepage_info[num_sizes];
hpi->hugepage_sz =
rte_str_to_size(&dirent->d_name[dirent_start_len]);
hpi = &internal_config.hugepage_info[num_sizes];
hpi->hugepage_sz =
rte_str_to_size(&dirent->d_name[dirent_start_len]);
@@
-305,7
+311,7
@@
eal_hugepage_info_init(void)
num_pages = get_num_hugepages(dirent->d_name);
if (num_pages > 0)
num_pages = get_num_hugepages(dirent->d_name);
if (num_pages > 0)
- RTE_LOG(
INFO
, EAL,
+ RTE_LOG(
NOTICE
, EAL,
"%" PRIu32 " hugepages of size "
"%" PRIu64 " reserved, but no mounted "
"hugetlbfs found for that size\n",
"%" PRIu32 " hugepages of size "
"%" PRIu64 " reserved, but no mounted "
"hugetlbfs found for that size\n",
@@
-348,14
+354,8
@@
eal_hugepage_info_init(void)
internal_config.num_hugepage_sizes = num_sizes;
/* sort the page directory entries by size, largest to smallest */
internal_config.num_hugepage_sizes = num_sizes;
/* sort the page directory entries by size, largest to smallest */
- for (i = 0; i < num_sizes; i++) {
- unsigned j;
- for (j = i+1; j < num_sizes; j++)
- if (internal_config.hugepage_info[j-1].hugepage_sz <
- internal_config.hugepage_info[j].hugepage_sz)
- swap_hpi(&internal_config.hugepage_info[j-1],
- &internal_config.hugepage_info[j]);
- }
+ qsort(&internal_config.hugepage_info[0], num_sizes,
+ sizeof(internal_config.hugepage_info[0]), compare_hpi);
/* now we have all info, check we have at least one valid size */
for (i = 0; i < num_sizes; i++)
/* now we have all info, check we have at least one valid size */
for (i = 0; i < num_sizes; i++)