Merge "Core dump on SCHED_OTHER"
diff --git a/third_party/google-glog/src/logging.cc b/third_party/google-glog/src/logging.cc
index ad4047d..2bfce3d 100644
--- a/third_party/google-glog/src/logging.cc
+++ b/third_party/google-glog/src/logging.cc
@@ -1459,6 +1459,13 @@
   // someone else can use them (as long as they flush afterwards)
   if (data_->severity_ == GLOG_FATAL && exit_on_dfatal) {
     if (data_->first_fatal_) {
+      {
+        // Put this back on SCHED_OTHER by default.
+        struct sched_param param;
+        param.sched_priority = 0;
+        sched_setscheduler(0, SCHED_OTHER, &param);
+      }
+
       // Store crash information so that it is accessible from within signal
       // handlers that may be invoked later.
       RecordCrashReason(&crash_reason);
diff --git a/third_party/google-glog/src/signalhandler.cc b/third_party/google-glog/src/signalhandler.cc
index c3a0f80..049efa5 100644
--- a/third_party/google-glog/src/signalhandler.cc
+++ b/third_party/google-glog/src/signalhandler.cc
@@ -308,6 +308,14 @@
       sleep(1);
     }
   }
+
+  {
+    // Put this back on SCHED_OTHER by default.
+    struct sched_param param;
+    param.sched_priority = 0;
+    sched_setscheduler(0, SCHED_OTHER, &param);
+  }
+
   // This is the first time we enter the signal handler.  We are going to
   // do some interesting stuff from here.
   // TODO(satorux): We might want to set timeout here using alarm(), but