How to initialize the new attributes in process control block.

Youcun Liu liuyoucun1993 at gmail.com
Mon May 16 04:44:56 EDT 2016


Hi.
Thanks for your time and last weekend I raised a problem, but it maybe not
so detail, So I want to detail my problem.

My problem is that I insert a new variable into struct sched_entity
<http://lxr.free-electrons.com/source/include/linux/ident?i=sched_entity>,
like that

struct sched_entity {
       struct load_weight      load;           /* for load-balancing */
       struct rb_node          run_node;
       struct list_head        group_node;
       unsigned int            on_rq;

       u64                     exec_start;
       u64                     sum_exec_runtime;
       u64                     vruntime;
       u64                     prev_sum_exec_runtime;
       u64 cache_miss_rate;   // the new variable I insert

       u64                     nr_migrations;
.....
.....
       }
for the new comming process I want to set the new variable as 1. Then after
the process executed, I calculate the cache miss rate and I feed the data
into the variable(update the variable), then use the data to modify some
other parameter(e.g vruntime and slice) in the kernel. But I do not how to
initialize the new variable(or whether I need to initialize the new
variable) for the new comming process(I know that the child process would
copy PCB from its parent process, but at the very beginning, the init
process has to initialize the variable.)
Besides, I also have trouble in finding out how to feed data into the new
variable from user level application.

Thanks a lot.
Best Regards.

2016-05-14 11:16 GMT+02:00 Youcun Liu <liuyoucun1993 at gmail.com>:

> Dear all,
>
> I am now working on building my own linux kernel and I want to add a new
> attribute into the process control block. Then I will feed some data to the
> new attribute from a user application. Finally I want to use the date to
> improve the some original kernel algorithm(e.g process schduling).
>
> I tried to initialize the new attribute directly in the 'task_struct',
> obviously, it failed. So I decide to initialize the new attribute at the
> very beginning, but I do not know how. Besides, I have trouble in finding
> out which function can help me feed data to the new attribute.
>
> Could you please give me some suggestions and help? Thanks a lot.
>
> Best regards,
> Youcun Liu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160516/f7cedde0/attachment.html 


More information about the Kernelnewbies mailing list