Red Hat Bugzilla – Bug 981037
[PERF] get mcs labels in constant time
Last modified: 2016-11-07 22:47:14 EST
I'm not sure how big of a deal this is, but it bothers me that we're doing linear searches to "calculate" mcs labels, so I'd like to do it in constant time. One solution would be to cache the mapping; another would be to use some middle school algebra. I'm doing the latter.
Created attachment 768455 [details]
Patch to calculate mcs labels
For a max uid of 7000, there's only about 0.1 second difference between the linear search and this patch (assuming the patch for https://bugzilla.redhat.com/show_bug.cgi?id=981022 is applied in both cases). The linear search takes about 0.1 extra seconds for each additional 10000 uids, though. Also, on busy machines, the "real" or "wall clock" time can be much longer, which affects the user experience for things like ssh logins.
Thanks! Patch looks good and gets the right numbers.
Commit pushed to master at https://github.com/openshift/origin-server
Bug 981037 - Use an O(1) generator for the common use case.
Test on devenv_3471, the time of run oo-get-mcs-level reduced a lot than the stage_ami.
[root@ip-10-147-131-70 ~]# time oo-get-mcs-level 523775
For patched devenv:
[root@ip-10-152-170-195 ~]# time oo-get-mcs-level 523775
Move bug to verified.