IO wait is high, causing SWT to restart case analysis

f3c75a6571145b0a7354a0c92bdae798.gif

Learn with you for lifeXi, this is Programmer Android

Recommended classic articles. By reading this article, you will gain the following knowledge points:

1. When copying large files, high IO wait causes SWT to restart. 2.
Solution to restart due to high IO wait.

1. Copying large files, IO wait is high, causing SWT to restart

1. By  AEE grabbinglog

The parts  Log are as follows:

9ee50eb5318458cbd4f2f115a8346701.jpeg

Aee log

2. High IO leads to high CPU usage

The parts  Log are as follows:

8962a6ca7e64001904691098ce9eae33.jpeg

Block IO is high causing reboot

2. Solution to restart caused by high IO wait

1. Adjust the kernel and optimize IO

By adjusting the kernel parameters, the peaks of write activity are distributed into frequent multiple writes, with less data written each time. The execution efficiency of this method is relatively low, but it reduces the opportunity for the kernel to combine write operations and reduces the probability of restart.

Modify init.rc the file
path as follows:
system/core/rootdir/init.rc

# Tweak background writeout
     write /proc/sys/vm/dirty_expire_centisecs 200
-    write /proc/sys/vm/dirty_background_ratio  3
-    write /proc/sys/vm/dirty_ratio 10
+    write /proc/sys/vm/dirty_background_ratio  1
+    write /proc/sys/vm/dirty_ratio 2
        
     # Permissions for System Server and daemons.
     chown radio system /sys/android_power/state

2. Turn off ANR dump information

Modify the init.aee.customer.rc file
and modify the code as follows:
/vendor/mediatek/proprietary/external/aee/config_external/init.aee.customer.rc

on init
     export LD_PRELOAD libdirect-coredump.so
     write /proc/self/coredump_filter 39
+       setprop persist.dbg.anrflow 1
 
 on property:vold.decrypt=trigger_restart_framework
     restart debuggerd

3. Close wtf dump file log information

When copying large files to the mobile phone (5G以上), the phone IO wait will be very high at this time. At this time Dump ANR wtf, waiting for information will be seriously affected IO wait. If the system becomes 1分钟unresponsive, the watchdog will automatically restart the phone. Therefore , it is recommended to turn off the information IO waitwhen  the system is too high. dump, alleviate CPUthe problem of excessive load.

Comment out the Log printing code path in AMS
ActivityManagerServiceas follows:
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService

public final class ActivityManagerService extends ActivityManagerNative

                 // should be protected to avoid security holes, so yell loudly

                 // to ensure we examine these cases.

                 if (callerApp != null) {

-                    Log.wtf(TAG, "Sending non-protected broadcast " + action

-                            + " from system " + callerApp.toShortString() + " pkg " + callerPackage,

-                            new Throwable());

+                                       // add for copy 5G file reboot 

+                                       android.util.Log.e("wangjie","Sending non-protected broadcast cause reboot pkg "+callerPackage);                

+                    //Log.wtf(TAG, "Sending non-protected broadcast " + action

+                     //       + " from system " + callerApp.toShortString() + " pkg " + callerPackage,

+                      //      new Throwable());

+                                       // add for copy 5G file reboot          

                 } else {

-                    Log.wtf(TAG, "Sending non-protected broadcast " + action

-                            + " from system uid " + UserHandle.formatUid(callingUid)

-                            + " pkg " + callerPackage,

-                            new Throwable());

-                }

+                                       // add for copy 5G file reboot 

+                                       android.util.Log.e("wangjie","Sending non-protected broadcast cause reboot pkg "+callerPackage);        

+                    //  Log.wtf(TAG, "Sending non-protected broadcast " + action

+                    //        + " from system uid " + UserHandle.formatUid(callingUid)

+                   //         + " pkg " + callerPackage,

+                   //         new Throwable());

+                                  // add for copy 5G file reboot 

+                }

+                               

+                               // add for copy 5G file reboot 

             }

         } else {
    
    

references:

[Tencent Documentation] Android Framework Knowledge Base
https://docs.qq.com/doc/DSXBmSG9VbEROUXF5

Friendly recommendation:

Collection of useful information on Android development

At this point, this article has ended. The editor thinks the article is reprinted from the Internet and is excellent. You are welcome to click to read the original article and support the original author. If there is any infringement, please contact the editor to delete it. Your suggestions and corrections are welcome. We look forward to your attention and thank you for reading, thank you!

354df977c9a828b9f1e1e05c3d316e5c.jpeg

Click to read the original article and like the boss!

Guess you like

Origin blog.csdn.net/wjky2014/article/details/131989888