From f85be7f859502239f12722877639cf3830e8fdca Mon Sep 17 00:00:00 2001
From: Jeff Vander Stoep <jeffv@google.com>
Date: Mon, 5 Jun 2017 17:01:17 -0700
Subject: [PATCH] Move sysfs cpu hotplug labeling to genfs_contexts

On Marlin ~120 ms of time is spent relabeling /sys/devices/system/cpu
every time we come out of suspend. Moving from file_contexts to
genfs_contexts as the labeling mechanism knocks this down to ~3 ms.

Bug: 32938130
Test: build and boot Marlin. Verify that files in
    /sys/devices/system/cpu have the proper label before and after
    suspend.

Change-Id: Ie71ea7e3dd5df250cabe4ba9600afbf67e69f720
---
 private/file_contexts  | 1 -
 private/genfs_contexts | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/private/file_contexts b/private/file_contexts
index b13807f79..4867796e4 100644
--- a/private/file_contexts
+++ b/private/file_contexts
@@ -453,7 +453,6 @@
 #
 /sys/class/leds(/.*)?                        u:object_r:sysfs_leds:s0
 /sys/devices/platform/nfc-power/nfc_power -- u:object_r:sysfs_nfc_power_writable:s0
-/sys/devices/system/cpu(/.*)?    u:object_r:sysfs_devices_system_cpu:s0
 /sys/devices/virtual/block/zram\d+(/.*)?     u:object_r:sysfs_zram:s0
 /sys/devices/virtual/block/zram\d+/uevent    u:object_r:sysfs_zram_uevent:s0
 /sys/devices/virtual/misc/hw_random(/.*)?    u:object_r:sysfs_hwrandom:s0
diff --git a/private/genfs_contexts b/private/genfs_contexts
index c2cfa2cce..a2d9b892f 100644
--- a/private/genfs_contexts
+++ b/private/genfs_contexts
@@ -47,6 +47,7 @@ genfscon selinuxfs / u:object_r:selinuxfs:s0
 genfscon cgroup / u:object_r:cgroup:s0
 # sysfs labels can be set by userspace.
 genfscon sysfs / u:object_r:sysfs:s0
+genfscon sysfs /devices/system/cpu u:object_r:sysfs_devices_system_cpu:s0
 genfscon inotifyfs / u:object_r:inotify:s0
 genfscon vfat / u:object_r:vfat:s0
 genfscon debugfs / u:object_r:debugfs:s0
-- 
GitLab