zhaoyanghong
驱动小牛
驱动小牛
  • 注册日期2004-11-13
  • 最后登录2008-08-05
  • 粉丝0
  • 关注0
  • 积分341分
  • 威望92点
  • 贡献值0点
  • 好评度91点
  • 原创分0分
  • 专家分0分
阅读:1907回复:2

linux network RCU问题请教 ?

楼主#
更多 发布于:2007-07-10 09:09


kernel 2.6.18.x
net/ipv4/af_inet.c的函数:
void inet_register_protosw(struct inet_protosw *p)
{
        struct list_head *lh;
        struct inet_protosw *answer;
        int protocol = p->protocol;
        struct list_head *last_perm;

        spin_lock_bh(&inetsw_lock);

        if (p->type >= SOCK_MAX)
                goto out_illegal;

        /* If we are trying to override a permanent protocol, bail. */
        answer = NULL;
        last_perm = &inetsw[p->type];
        list_for_each(lh, &inetsw[p->type]) {
                answer = list_entry(lh, struct inet_protosw, list);

                /* Check only the non-wild match. */
                if (INET_PROTOSW_PERMANENT & answer->flags) {
                        if (protocol == answer->protocol)
                                break;
                        last_perm = lh;
                }

                answer = NULL;
        }
        if (answer)
                goto out_permanent;

        /* Add the new entry after the last permanent entry if any, so that
         * the new entry does not override a permanent entry when matched with
         * a wild-card protocol. But it is allowed to override any existing
         * non-permanent entry.  This means that when we remove this entry, the
         * system automatically returns to the old behavior.
         */
        list_add_rcu(&p->list, last_perm);
out:
        spin_unlock_bh(&inetsw_lock);

        synchronize_net();

        return;

out_permanent:
        printk(KERN_ERR "Attempt to override permanent protocol %d.\n",
               protocol);
        goto out;

out_illegal:
        printk(KERN_ERR
               "Ignoring attempt to register invalid socket type %d.\n",
               p->type);
        goto out;
}

没有发现给per_cpu_rcu_bh_data 注册的callbacks函数 ?  请高人解释一下?
cyliu
论坛版主
论坛版主
  • 注册日期2003-06-13
  • 最后登录2014-04-11
  • 粉丝5
  • 关注0
  • 积分1238分
  • 威望2531点
  • 贡献值0点
  • 好评度577点
  • 原创分14分
  • 专家分10分
沙发#
发布于:2007-07-11 22:46
哪里有你描述的per_cpu_rcu_bh_data?没有明白你问的问题
走走看看开源好 Solaris vs Linux
zhaoyanghong
驱动小牛
驱动小牛
  • 注册日期2004-11-13
  • 最后登录2008-08-05
  • 粉丝0
  • 关注0
  • 积分341分
  • 威望92点
  • 贡献值0点
  • 好评度91点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2007-07-13 09:15
阁下还是搞明白RCU机制后回答我的问题.
游客

返回顶部