Re: Problem in using Kernel Timers: Sleeping function called from invalid context

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

 



hi,

> Thanks topi
>           After using the GFP_ATOMIC flag in kmalloc it's not showing the
> stack trace. But is it good to use this mechanism (on long term basis) for
> sending signals (in every 1mSec) to a server process running in
> user-space.
>          I am not using kfree() for the task_struct *p variable because
> find_task_by_pid() returns a pointer to the PCB, so if i'll free the
> pointer
> then it frees that memory block and i am getting a segmentation fault.

it sounds to me a unnecessary allocation, so if find_task_by_pid return a
pointer to a preexisting struct you don't need to allocate any memory
(it's already allocated)

afaik, the only think happening is that you're allocating memory before
changing the pointer and forgetting that allocated memory and, thus,
missing it.

hope this helps...

topi

>         Please correct me if i am wrong.
>
> regards
> Ganesh
>
> On 2/16/07, Tetsuo Handa <penguin-newbie@xxxxxxxxxxxxxxxxxxx> wrote:
>>
>> Ganesh PS wrote:
>> > void gen_sig(void){
>> >     struct task_struct *p=NULL;
>> >     p=kmalloc(sizeof(struct task_struct), GFP_KERNEL);
>> >
>> >     p = find_task_by_pid(pid); /*Received from a user program through
>> ioctl()*/
>>
>> What is this kmalloc() for?
>> You don't kfree() this pointer?
>>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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