RFR: 8283199: Linux os::cpu_microcode_revision() stalls cold startup [v2]
Claes Redestad
redestad at openjdk.java.net
Mon Mar 21 10:33:12 UTC 2022
On Mon, 21 Mar 2022 10:22:04 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp line 484:
>>
>>> 482: // Attempt 2 (slower): Read the microcode version off the procfs.
>>> 483: {
>>> 484: FILE *fp = os::fopen("/proc/cpuinfo", "r");
>>
>> Should this now slow-path continue to use a 2048 element buffer?
>
> No, because AFAICS, `fgets` reads until buffer is full or the EOL is read. We are looking for a rather short "microcode: 0x..." line in procfs, so there is no need to allocate the entire 2K for this. This was my first attempt to improve this code, and it is not directly relevant to issue at hand, so I can revert it, if that's a questionable change.
Ok, makes sense. If it's safe and works I don't mind if you keep it. I guess JDK-8283200 will make such micro-optimizations moot, though.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7825
More information about the hotspot-runtime-dev
mailing list