@@ -94,34 +94,34 @@ impl HugeTlbController {
94
94
}
95
95
96
96
/// Whether the system supports `hugetlb_size` hugepages.
97
- pub fn size_supported ( & self , _hugetlb_size : String ) -> bool {
97
+ pub fn size_supported ( & self , _hugetlb_size : & str ) -> bool {
98
98
// TODO
99
99
true
100
100
}
101
101
102
102
/// Check how many times has the limit of `hugetlb_size` hugepages been hit.
103
- pub fn failcnt ( & self , hugetlb_size : & String ) -> Result < u64 > {
103
+ pub fn failcnt ( & self , hugetlb_size : & str ) -> Result < u64 > {
104
104
self . open_path ( & format ! ( "hugetlb.{}.failcnt" , hugetlb_size) , false )
105
105
. and_then ( read_u64_from)
106
106
}
107
107
108
108
/// Get the limit (in bytes) of how much memory can be backed by hugepages of a certain size
109
109
/// (`hugetlb_size`).
110
- pub fn limit_in_bytes ( & self , hugetlb_size : & String ) -> Result < u64 > {
110
+ pub fn limit_in_bytes ( & self , hugetlb_size : & str ) -> Result < u64 > {
111
111
self . open_path ( & format ! ( "hugetlb.{}.limit_in_bytes" , hugetlb_size) , false )
112
112
. and_then ( read_u64_from)
113
113
}
114
114
115
115
/// Get the current usage of memory that is backed by hugepages of a certain size
116
116
/// (`hugetlb_size`).
117
- pub fn usage_in_bytes ( & self , hugetlb_size : & String ) -> Result < u64 > {
117
+ pub fn usage_in_bytes ( & self , hugetlb_size : & str ) -> Result < u64 > {
118
118
self . open_path ( & format ! ( "hugetlb.{}.usage_in_bytes" , hugetlb_size) , false )
119
119
. and_then ( read_u64_from)
120
120
}
121
121
122
122
/// Get the maximum observed usage of memory that is backed by hugepages of a certain size
123
123
/// (`hugetlb_size`).
124
- pub fn max_usage_in_bytes ( & self , hugetlb_size : & String ) -> Result < u64 > {
124
+ pub fn max_usage_in_bytes ( & self , hugetlb_size : & str ) -> Result < u64 > {
125
125
self . open_path (
126
126
& format ! ( "hugetlb.{}.max_usage_in_bytes" , hugetlb_size) ,
127
127
false ,
@@ -130,7 +130,7 @@ impl HugeTlbController {
130
130
131
131
/// Set the limit (in bytes) of how much memory can be backed by hugepages of a certain size
132
132
/// (`hugetlb_size`).
133
- pub fn set_limit_in_bytes ( & self , hugetlb_size : & String , limit : u64 ) -> Result < ( ) > {
133
+ pub fn set_limit_in_bytes ( & self , hugetlb_size : & str , limit : u64 ) -> Result < ( ) > {
134
134
self . open_path ( & format ! ( "hugetlb.{}.limit_in_bytes" , hugetlb_size) , true )
135
135
. and_then ( |mut file| {
136
136
file. write_all ( limit. to_string ( ) . as_ref ( ) )
0 commit comments