On 06/01/17 13:52, Matias Elo wrote: > A system may simultaneously support multiple huge page sizes. Add a new API > function odp_sys_huge_page_size_all() which returns all supported page > sizes. odp_sys_huge_page_size() stays unmodified to maintain backward > compatibility. > > Signed-off-by: Matias Elo <matias....@nokia.com> > --- > include/odp/api/spec/system_info.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/include/odp/api/spec/system_info.h > b/include/odp/api/spec/system_info.h > index ca4dcdc..c41d3c5 100644 > --- a/include/odp/api/spec/system_info.h > +++ b/include/odp/api/spec/system_info.h > @@ -27,10 +27,29 @@ extern "C" { > * Default system huge page size in bytes > * > * @return Default huge page size in bytes > + * @retval 0 on no huge pages > */ > uint64_t odp_sys_huge_page_size(void); > > /** > + * System huge page sizes in bytes > + * > + * Returns the number of huge page sizes supported by the system. Outputs up > to > + * 'num' sizes when the 'size' array pointer is not NULL. If return value is > + * larger than 'num', there are more supported sizes than the function was > + * allowed to output. If return value (N) is less than 'num', only sizes > + * [0 ... N-1] have been written. Returned values are ordered from smallest > to > + * largest. > + * > + * @param[out] size Points to an array of huge page sizes for output > + * @param num Maximum number of huge page sizes to output > + * > + * @return Number of supported huge page sizes > + * @retval 0 on no huge pages > + */ > +unsigned odp_sys_huge_page_size_all(uint64_t size[], unsigned num); > +
I think it has to be int. -1 on error, 0 - no hp, > 0 pages. For linux it might be similar to getpagesizes() https://linux.die.net/man/3/getpagesizes """ if pagesizes is NULL and n_elem is 0, then the number of pages the system supports is returned. Otherwise, pagesizes is filled with at most n_elem page sizes. """ num might be better to set to int also. For size uint64_t looks like ok. But why do we need this inside ODP? It time be reasonable to say that it's number of pages/sizes visible to current ODP instance (i.e. not the system global.) Maxim. > +/** > * Page size in bytes > * > * @return Page size in bytes >