dshadow79
驱动牛犊
驱动牛犊
  • 注册日期2002-09-29
  • 最后登录2006-04-10
  • 粉丝0
  • 关注0
  • 积分20分
  • 威望2点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
阅读:1437回复:0

为什么网卡接收数据的时候只有cpu0工作?

楼主#
更多 发布于:2005-03-13 11:10
e1000的网卡,我在indicate函数里设了一个计数器,计算每个cpu执行的次数,可是只能看到cpu0的计数器在加,其它都是0

我想这个原因应该是softirq的tasklet实现导致的吧?tasklet只能在同一个cpu上运行,使得网卡的poll函数都是在同一个cpu上调用的

有没有什么办法让tasklet在别的cpu上调度来增加并行性?我试着弄了一个async版本的tasklet_schedule,但是crash了,哪位达人帮忙看看

linux 2.4.20,带napi,双xeon

static INLINE void async_tasklet_schedule( struct tasklet_struct *t )
{
// this is codes copied from original tasklet_schedule
// I change it to schedule on another cpu
int cpu = smp_processor_id( ) ^ 1; // if current cpu is CPU#0, schedule the tasklet on CPU#1
// if current cpu is CPU#1, schedule the tasklet on CPU#0
// if current cpu is CPU#2, schedule the tasklet on CPU#3
// if current cpu is CPU#3, schedule the tasklet on CPU#2
// unsigned long flags;

// should use spinlocks here, but ...
// local_irq_save( flags ); no need to save flags
t->next = tasklet_vec[ cpu ].list;
tasklet_vec[ cpu ].list = t;
cpu_raise_softirq( cpu, TASKLET_SOFTIRQ );
// local_irq_restore( flags );
游客

返回顶部