ANDROID: uid_sys_stats: check previous uid_entry before call find_or_register_uid
Theads in a process are stored in list struct task_struct->thread_group,
so it will be visited continiously in below loop:
do_each_thread(temp, task) {
...
} while_each_thread(temp, task);
I add some log in the loop, we can see below information:
[ 65.033561] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033567] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033574] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033581] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033588] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033595] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033602] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033609] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033615] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033622] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033629] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033637] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033644] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033651] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033658] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033665] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033672] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033680] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033687] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033694] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033701] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033708] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033715] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033722] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033729] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033736] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033743] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033750] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033757] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033763] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033770] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033777] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033784] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033791] uid 1000, uid_entry
ffffffc0f2761600
[ 65.033798] uid 1000, uid_entry
ffffffc0f2761600
So we can check the previous uid_entry before calling find_or_register_uid
to save time.
Change-Id: I05ec1a1405a80c0a620cb4b4b2f6483dbfde7829
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>