lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080627213805.jdqshto0ys4oookk@webmail1.sjtu.edu.cn>
Date:	Fri, 27 Jun 2008 21:38:05 +0800
From:	xialiang <xiaiaxaxi@...u.edu.cn>
To:	Bart Van Assche <bart.vanassche@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: How can I migrate a currently running task?

Quoting Bart Van Assche <bart.vanassche@...il.com>:

> On Fri, Jun 27, 2008 at 3:17 PM, 夏亮 <xiaiaxaxi@...u.edu.cn> wrote:
>> I am working on Intel Duo Core with Linux OS 2.6.21, and I'd like to
>> migrate task from one cpu to another cpu.
>> In SMP systems, load_balance() function uses move_tasks() to move processes
>> from source runqueue to local runqueue, but it does not move a currently
>> running task. If I want to migrate a currently running task from source
>> runqueue to local runqueue, how can I do? Any suggestion is preferred.
>
> Are you familiar with the glibc pthread_setaffinity_np() function
> and/or the sched_setaffinity() system call ?
>
> Bart.
>

Yes. I know sched_setaffinity(), it sets cpu_mask of a task. I want to  
use it in a timer interrupt( scheduler_tick() ), can I?

I use sched_getaffinity() in a timer interrupt, but it doesn't work.As  
following,

scheduler_tick()
{
     every 100ms, balance();
}

static int balance(void)
{
     Get temperature of two cpus.
     int ret;
     cpumask_t mask;

     If(one cpu is much hotter than another one){
         ret = sched_getaffinity(rq->curr->pid, &mask);
     }
}

If I comment sched_getaffinity, it works well.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ