Re: How to initialize the new attributes in process control block.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, 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@xxxxxxxxx>:
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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux