Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
kernel: Affine hwcomposer to big CPUs
Browse files Browse the repository at this point in the history
HWC in Android is responsible for communicating userspace's graphics
requests with the kernel. Affining it to fast CPUs greatly reduces
jitter.

Signed-off-by: Sultan Alsawaf <[email protected]>
Signed-off-by: VoidDev-0 <[email protected]>
  • Loading branch information
kerneltoast authored and VoidDev-0 committed Mar 30, 2022
1 parent 051c9be commit 8615eac
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ int suid_dumpable = 0;
static LIST_HEAD(formats);
static DEFINE_RWLOCK(binfmt_lock);

#define HWCOMPOSER_BIN_PREFIX "/vendor/bin/hw/android.hardware.graphics.composer"
#define ZYGOTE32_BIN "/system/bin/app_process32"
#define ZYGOTE64_BIN "/system/bin/app_process64"
static struct signal_struct *zygote32_sig;
static struct signal_struct *zygote64_sig;

bool task_is_zygote(struct task_struct *p)
{
return p->signal == zygote32_sig || p->signal == zygote64_sig;
}

void __register_binfmt(struct linux_binfmt * fmt, int insert)
{
BUG_ON(!fmt);
Expand Down Expand Up @@ -1819,6 +1830,19 @@ static int do_execveat_common(int fd, struct filename *filename,
if (retval < 0)
goto out;

if (is_global_init(current->parent)) {
if (unlikely(!strcmp(filename->name, ZYGOTE32_BIN)))
zygote32_sig = current->signal;
else if (unlikely(!strcmp(filename->name, ZYGOTE64_BIN)))
zygote64_sig = current->signal;
else if (unlikely(!strncmp(filename->name,
HWCOMPOSER_BIN_PREFIX,
strlen(HWCOMPOSER_BIN_PREFIX)))) {
current->flags |= PF_PERF_CRITICAL;
set_cpus_allowed_ptr(current, cpu_perf_mask);
}
}

/* execve succeeded */
current->fs->in_exec = 0;
current->in_execve = 0;
Expand Down

0 comments on commit 8615eac

Please sign in to comment.