Hi, On 7/16/19 8:09 AM, Aniket Masule wrote: > Present core assignment is static. Introduced load balancing > across the cores. Load on earch core is calculated and core > with minimum load is assigned to given instance. > > Signed-off-by: Aniket Masule <amasule@xxxxxxxxxxxxxx> > --- > drivers/media/platform/qcom/venus/helpers.c | 69 +++++++++++++++++++++++--- > drivers/media/platform/qcom/venus/helpers.h | 2 +- > drivers/media/platform/qcom/venus/hfi_helper.h | 1 + > drivers/media/platform/qcom/venus/hfi_parser.h | 5 ++ > drivers/media/platform/qcom/venus/vdec.c | 2 +- > drivers/media/platform/qcom/venus/venc.c | 2 +- > 6 files changed, 72 insertions(+), 9 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c > index edf403d..d479793 100644 > --- a/drivers/media/platform/qcom/venus/helpers.c > +++ b/drivers/media/platform/qcom/venus/helpers.c > @@ -26,6 +26,7 @@ > #include "helpers.h" > #include "hfi_helper.h" > #include "hfi_venus_io.h" > +#include "hfi_parser.h" > > struct intbuf { > struct list_head list; > @@ -331,6 +332,24 @@ static u32 load_per_instance(struct venus_inst *inst) > return mbs * inst->fps; > } > > +static u32 load_per_core(struct venus_core *core, u32 core_id) > +{ > + struct venus_inst *inst = NULL; > + u32 mbs_per_sec = 0, load = 0; > + > + mutex_lock(&core->lock); > + list_for_each_entry(inst, &core->instances, list) { > + if (inst->clk_data.core_id != core_id) > + continue; > + > + mbs_per_sec = load_per_instance(inst); > + load = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq; shouldn't this be load += mbs_per_sec * vpp_freq ? We need to calculate load for every instance on this core_id. > + } > + mutex_unlock(&core->lock); > + > + return load; > +} > + <cut> -- regards, Stan