- Timestamp:
- Jun 5, 2020 2:06:42 AM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/Makefile.kmk
r3192 r3355 78 78 nt/ntunlink.c \ 79 79 nt/kFsCache.c \ 80 win_get_processor_group_active_mask.c \ 80 81 quote_argv.c \ 81 82 is_console.c \ -
trunk/src/kWorker/kWorker.c
r3347 r3355 55 55 #include "nt/kFsCache.h" 56 56 #include "nt_fullpath.h" 57 #include "win_get_processor_group_active_mask.h" 57 58 #include "quote_argv.h" 58 59 #include "md5.h" … … 12284 12285 12285 12286 12287 /** 12288 * Helper for main() argument handling that sets the processor group if 12289 * possible. 12290 */ 12291 static void kwSetProcessorGroup(unsigned long uGroup) 12292 { 12293 typedef BOOL (WINAPI *PFNSETTHREADGROUPAFFINITY)(HANDLE, const GROUP_AFFINITY*, GROUP_AFFINITY *); 12294 HMODULE const hmodKernel32 = GetModuleHandleW(L"KERNEL32.DLL"); 12295 PFNSETTHREADGROUPAFFINITY pfnSetThreadGroupAffinity; 12296 12297 pfnSetThreadGroupAffinity = (PFNSETTHREADGROUPAFFINITY)GetProcAddress(hmodKernel32, "SetThreadGroupAffinity"); 12298 if (pfnSetThreadGroupAffinity) 12299 { 12300 GROUP_AFFINITY OldAff = { 0, 0, 0, 0, 0 }; 12301 GROUP_AFFINITY NewAff = { 0, (WORD)uGroup, 0, 0, 0 }; 12302 NewAff.Mask = win_get_processor_group_active_mask((WORD)uGroup); 12303 if (NewAff.Mask && (WORD)uGroup == uGroup) 12304 { 12305 if (!pfnSetThreadGroupAffinity(GetCurrentThread(), &NewAff, &OldAff)) 12306 kwErrPrintf("Failed to set processor group to %lu (%p): %u\n", uGroup, NewAff.Mask, GetLastError()); 12307 } 12308 else if (GetLastError() == NO_ERROR) 12309 kwErrPrintf("Cannot set processor group to %lu: No active processors in group!\n", uGroup); 12310 else 12311 kwErrPrintf("Cannot set processor group to %lu: GetLogicalProcessorInformationEx failed: %u\n", 12312 uGroup, GetLastError()); 12313 } 12314 else 12315 { 12316 OSVERSIONINFOA VerInfo = {0}; 12317 if (VerInfo.dwMajorVersion > 6 || (VerInfo.dwMajorVersion == 6 && VerInfo.dwMinorVersion >= 1)) 12318 kwErrPrintf("Cannot set processor group to %lu: SetThreadGroupAffinity no found! (Windows version %lu.%lu)\n", 12319 uGroup, VerInfo.dwMajorVersion, VerInfo.dwMinorVersion); 12320 } 12321 } 12322 12323 12286 12324 int main(int argc, char **argv) 12287 12325 { … … 12511 12549 && *pszEnd == '\0' 12512 12550 && uValue == (WORD)uValue) 12513 { 12514 typedef BOOL (WINAPI *PFNSETTHREADGROUPAFFINITY)(HANDLE, const GROUP_AFFINITY*, GROUP_AFFINITY *); 12515 PFNSETTHREADGROUPAFFINITY pfnSetThreadGroupAffinity; 12516 pfnSetThreadGroupAffinity = (PFNSETTHREADGROUPAFFINITY)GetProcAddress(GetModuleHandleW(L"KERNEL32.DLL"), 12517 "SetThreadGroupAffinity"); 12518 if (pfnSetThreadGroupAffinity) 12519 { 12520 GROUP_AFFINITY NewAff = { ~(uintptr_t)0, (WORD)uValue, 0, 0, 0 }; 12521 GROUP_AFFINITY OldAff = { 0, 0, 0, 0, 0 }; 12522 if (!pfnSetThreadGroupAffinity(GetCurrentThread(), &NewAff, &OldAff)) 12523 kwErrPrintf("Failed to set processor group to %lu: %u\n", uValue, GetLastError()); 12524 } 12525 else 12526 kwErrPrintf("Cannot set processor group to %lu because SetThreadGroupAffinity was not found\n", uValue); 12527 } 12551 kwSetProcessorGroup(uValue); 12528 12552 else 12529 12553 return kwErrPrintfRc(2, "Invalid --priority argument: %s\n", argv[i]); -
trunk/src/kmk/kmkbuiltin/kSubmit.c
r3313 r3355 588 588 if (iProcessorGroup >= 0 && g_pfnSetThreadGroupAffinity) 589 589 { 590 GROUP_AFFINITY NewAff = { ~(uintptr_t)0, (WORD)iProcessorGroup, 0, 0, 0 };591 GROUP_AFFINITY OldAff = { 0, 0, 0, 0, 0 };590 GROUP_AFFINITY OldAff = { 0, 0, 0, 0, 0 }; 591 GROUP_AFFINITY NewAff = { 0 /* == all active apparently */, (WORD)iProcessorGroup, 0, 0, 0 }; 592 592 if (!g_pfnSetThreadGroupAffinity(ProcInfo.hThread, &NewAff, &OldAff)) 593 593 warnx(pCtx, "warning: Failed to set processor group to %d: %u\n", -
trunk/src/kmk/w32/winchildren.c
r3353 r3355 551 551 Info.BasicLimitInformation.LimitFlags &= ~JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; 552 552 if (!SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &Info, sizeof(Info))) 553 OS N(message, 0, _("SetInformationJobObject(%s,JobObjectExtendedLimitInformation,{%s},) failed: %u"),554 pszJobName, win_job_object_mode, GetLastError());553 OSSN(message, 0, _("SetInformationJobObject(%s,JobObjectExtendedLimitInformation,{%s},) failed: %u"), 554 pszJobName, win_job_object_mode, GetLastError()); 555 555 } 556 556 else … … 1283 1283 if (g_cProcessorGroups > 1) 1284 1284 { 1285 GROUP_AFFINITY Affinity = { 0 , pWorker->iProcessorGroup, { 0, 0, 0 } };1285 GROUP_AFFINITY Affinity = { 0 /* == all active apparently */, pWorker->iProcessorGroup, { 0, 0, 0 } }; 1286 1286 fRet = g_pfnSetThreadGroupAffinity(ProcInfo.hThread, &Affinity, NULL); 1287 1287 assert(fRet); … … 2490 2490 if (g_cProcessorGroups > 1) 2491 2491 { 2492 GROUP_AFFINITY Affinity = { 0 /* == all active apparently */ 2492 GROUP_AFFINITY Affinity = { 0 /* == all active apparently */, pWorker->iProcessorGroup, { 0, 0, 0 } }; 2493 2493 BOOL fRet = g_pfnSetThreadGroupAffinity(GetCurrentThread(), &Affinity, NULL); 2494 2494 assert(fRet); (void)fRet;
Note:
See TracChangeset
for help on using the changeset viewer.