MCPcopy Create free account
hub / github.com/F-Stack/f-stack / set_hugepages

Function set_hugepages

dpdk/usertools/dpdk-hugepages.py:60–74  ·  view source on GitHub ↗

Write the number of reserved huge pages

(path, reqpages)

Source from the content-addressed store, hash-verified

58
59
60def set_hugepages(path, reqpages):
61 '''Write the number of reserved huge pages'''
62 filename = path + '/nr_hugepages'
63 try:
64 with open(filename, 'w') as nr_hugepages:
65 nr_hugepages.write('{}\n'.format(reqpages))
66 except PermissionError:
67 sys.exit('Permission denied: need to be root!')
68 except FileNotFoundError:
69 sys.exit("Invalid page size. Valid page sizes: {}".format(
70 get_valid_page_sizes(path)))
71 gotpages = get_hugepages(path)
72 if gotpages != reqpages:
73 sys.exit('Unable to set pages ({} instead of {} in {}).'.format(
74 gotpages, reqpages, filename))
75
76
77def show_numa_pages():

Callers 3

clear_pagesFunction · 0.85
set_numa_pagesFunction · 0.85
set_non_numa_pagesFunction · 0.85

Calls 3

get_valid_page_sizesFunction · 0.85
get_hugepagesFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected