Merge "Migrate pkvm_perf_test.py test_compilation_in_vm function to AOSP"
diff --git a/microdroid/kdump/crashdump.c b/microdroid/kdump/crashdump.c
index 47d359a..8dc84e9 100644
--- a/microdroid/kdump/crashdump.c
+++ b/microdroid/kdump/crashdump.c
@@ -42,6 +42,12 @@
 extern int __reboot(int, int, int, void*);
 
 int main() {
+    // Disable buffering for better display of the progress
+    if (setvbuf(stdout, NULL, _IONBF, 0) != 0) {
+        fprintf(stderr, "Failed to disable buffering for stdout: %s\n", strerror(errno));
+        // This isn't a critical error. Continue.
+    }
+
     printf("Crashdump started\n");
 
     if (mount("proc", "/proc", "proc", 0, NULL) == -1) {
@@ -87,12 +93,6 @@
     char buf[BUF_SIZE];
     int progress = 0; // percentage
 
-    // Disable buffering for better display of the progress
-    if (setvbuf(stdout, NULL, _IONBF, 0) != 0) {
-        fprintf(stderr, "Failed to disable buffering for stdout: %s\n", strerror(errno));
-        // This isn't a critical error. Continue.
-    }
-
     while (dumped < statbuf.st_size) {
         ssize_t read_bytes = read(vmcore, buf, BUF_SIZE);
         if (read_bytes == -1) {