MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / THPIsEnabled

Function THPIsEnabled

src/cmd/fedb.cc:183–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183int THPIsEnabled() {
184#if defined(__linux__) || defined(__mac_tablet__)
185 char buf[1024];
186 FILE* fp = fopen("/sys/kernel/mm/transparent_hugepage/enabled", "r");
187 if (!fp) {
188 return 0;
189 }
190 if (fgets(buf, sizeof(buf), fp) == NULL) {
191 fclose(fp);
192 return 0;
193 }
194 fclose(fp);
195 if (strstr(buf, "[never]") == NULL) {
196 return 1;
197 }
198 fp = fopen("/sys/kernel/mm/transparent_hugepage/defrag", "r");
199 if (!fp) return 0;
200 if (fgets(buf, sizeof(buf), fp) == NULL) {
201 fclose(fp);
202 return 0;
203 }
204 fclose(fp);
205 return (strstr(buf, "[never]") == NULL) ? 1 : 0;
206#else
207 return 0;
208#endif
209}
210
211int SwapIsEnabled() {
212#if defined(__linux__) || defined(__mac_tablet__)

Callers 1

StartTabletFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected