Merge branch 'linus' into core/softirq
authorIngo Molnar <mingo@elte.hu>
Mon, 23 Jun 2008 08:52:59 +0000 (10:52 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 23 Jun 2008 08:52:59 +0000 (10:52 +0200)
1  2 
kernel/rcupreempt.c
kernel/sched.c
net/core/dev.c

diff --combined kernel/rcupreempt.c
@@@ -217,8 -217,6 +217,6 @@@ long rcu_batches_completed(void
  }
  EXPORT_SYMBOL_GPL(rcu_batches_completed);
  
- EXPORT_SYMBOL_GPL(rcu_batches_completed_bh);
  void __rcu_read_lock(void)
  {
        int idx;
@@@ -1125,7 -1123,7 +1123,7 @@@ void __init __rcu_init(void
        for_each_online_cpu(cpu)
                rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE, (void *)(long) cpu);
  
 -      open_softirq(RCU_SOFTIRQ, rcu_process_callbacks, NULL);
 +      open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
  }
  
  /*
diff --combined kernel/sched.c
@@@ -1127,6 -1127,7 +1127,7 @@@ static enum hrtimer_restart hrtick(stru
        return HRTIMER_NORESTART;
  }
  
+ #ifdef CONFIG_SMP
  static void hotplug_hrtick_disable(int cpu)
  {
        struct rq *rq = cpu_rq(cpu);
@@@ -1182,6 -1183,7 +1183,7 @@@ static void init_hrtick(void
  {
        hotcpu_notifier(hotplug_hrtick, 0);
  }
+ #endif /* CONFIG_SMP */
  
  static void init_rq_hrtick(struct rq *rq)
  {
@@@ -6877,7 -6879,12 +6879,12 @@@ static int default_relax_domain_level 
  
  static int __init setup_relax_domain_level(char *str)
  {
-       default_relax_domain_level = simple_strtoul(str, NULL, 0);
+       unsigned long val;
+       val = simple_strtoul(str, NULL, 0);
+       if (val < SD_LV_MAX)
+               default_relax_domain_level = val;
        return 1;
  }
  __setup("relax_domain_level=", setup_relax_domain_level);
@@@ -7235,6 -7242,18 +7242,18 @@@ void __attribute__((weak)) arch_update_
  {
  }
  
+ /*
+  * Free current domain masks.
+  * Called after all cpus are attached to NULL domain.
+  */
+ static void free_sched_domains(void)
+ {
+       ndoms_cur = 0;
+       if (doms_cur != &fallback_doms)
+               kfree(doms_cur);
+       doms_cur = &fallback_doms;
+ }
  /*
   * Set up scheduler domains and groups. Callers must hold the hotplug lock.
   * For now this just excludes isolated cpus, but could be used to
@@@ -7382,6 -7401,7 +7401,7 @@@ int arch_reinit_sched_domains(void
        get_online_cpus();
        mutex_lock(&sched_domains_mutex);
        detach_destroy_domains(&cpu_online_map);
+       free_sched_domains();
        err = arch_init_sched_domains(&cpu_online_map);
        mutex_unlock(&sched_domains_mutex);
        put_online_cpus();
@@@ -7467,6 -7487,7 +7487,7 @@@ static int update_sched_domains(struct 
        case CPU_DOWN_PREPARE:
        case CPU_DOWN_PREPARE_FROZEN:
                detach_destroy_domains(&cpu_online_map);
+               free_sched_domains();
                return NOTIFY_OK;
  
        case CPU_UP_CANCELED:
                return NOTIFY_DONE;
        }
  
+ #ifndef CONFIG_CPUSETS
+       /*
+        * Create default domain partitioning if cpusets are disabled.
+        * Otherwise we let cpusets rebuild the domains based on the
+        * current setup.
+        */
        /* The hotplug lock is already held by cpu_up/cpu_down */
        arch_init_sched_domains(&cpu_online_map);
+ #endif
  
        return NOTIFY_OK;
  }
@@@ -7626,7 -7655,6 +7655,6 @@@ static void init_tg_rt_entry(struct tas
        else
                rt_se->rt_rq = parent->my_q;
  
-       rt_se->rt_rq = &rq->rt;
        rt_se->my_q = rt_rq;
        rt_se->parent = parent;
        INIT_LIST_HEAD(&rt_se->run_list);
@@@ -7806,7 -7834,7 +7834,7 @@@ void __init sched_init(void
  #endif
  
  #ifdef CONFIG_SMP
 -      open_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL);
 +      open_softirq(SCHED_SOFTIRQ, run_rebalance_domains);
  #endif
  
  #ifdef CONFIG_RT_MUTEXES
@@@ -8348,7 -8376,7 +8376,7 @@@ static unsigned long to_ratio(u64 perio
  #ifdef CONFIG_CGROUP_SCHED
  static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
  {
-       struct task_group *tgi, *parent = tg->parent;
+       struct task_group *tgi, *parent = tg ? tg->parent : NULL;
        unsigned long total = 0;
  
        if (!parent) {
diff --combined net/core/dev.c
  #include <linux/err.h>
  #include <linux/ctype.h>
  #include <linux/if_arp.h>
+ #include <linux/if_vlan.h>
  
  #include "net-sysfs.h"
  
@@@ -1362,6 -1363,29 +1363,29 @@@ void netif_device_attach(struct net_dev
  }
  EXPORT_SYMBOL(netif_device_attach);
  
+ static bool can_checksum_protocol(unsigned long features, __be16 protocol)
+ {
+       return ((features & NETIF_F_GEN_CSUM) ||
+               ((features & NETIF_F_IP_CSUM) &&
+                protocol == htons(ETH_P_IP)) ||
+               ((features & NETIF_F_IPV6_CSUM) &&
+                protocol == htons(ETH_P_IPV6)));
+ }
+ static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
+ {
+       if (can_checksum_protocol(dev->features, skb->protocol))
+               return true;
+       if (skb->protocol == htons(ETH_P_8021Q)) {
+               struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
+               if (can_checksum_protocol(dev->features & dev->vlan_features,
+                                         veh->h_vlan_encapsulated_proto))
+                       return true;
+       }
+       return false;
+ }
  
  /*
   * Invalidate hardware checksum when packet is to be mangled, and
@@@ -1640,14 -1664,8 +1664,8 @@@ int dev_queue_xmit(struct sk_buff *skb
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                skb_set_transport_header(skb, skb->csum_start -
                                              skb_headroom(skb));
-               if (!(dev->features & NETIF_F_GEN_CSUM) &&
-                   !((dev->features & NETIF_F_IP_CSUM) &&
-                     skb->protocol == htons(ETH_P_IP)) &&
-                   !((dev->features & NETIF_F_IPV6_CSUM) &&
-                     skb->protocol == htons(ETH_P_IPV6)))
-                       if (skb_checksum_help(skb))
-                               goto out_kfree_skb;
+               if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb))
+                       goto out_kfree_skb;
        }
  
  gso:
@@@ -2059,6 -2077,10 +2077,10 @@@ int netif_receive_skb(struct sk_buff *s
  
        rcu_read_lock();
  
+       /* Don't receive packets in an exiting network namespace */
+       if (!net_alive(dev_net(skb->dev)))
+               goto out;
  #ifdef CONFIG_NET_CLS_ACT
        if (skb->tc_verd & TC_NCLS) {
                skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
@@@ -4563,8 -4585,8 +4585,8 @@@ static int __init net_dev_init(void
  
        dev_boot_phase = 0;
  
 -      open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
 -      open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
 +      open_softirq(NET_TX_SOFTIRQ, net_tx_action);
 +      open_softirq(NET_RX_SOFTIRQ, net_rx_action);
  
        hotcpu_notifier(dev_cpu_callback, 0);
        dst_init();