diff -urp ../git/linux-2.6.8.1-work/kernel/pid.c linux-2.6.8.1/kernel/pid.c --- ../git/linux-2.6.8.1-work/kernel/pid.c 2006-06-02 18:02:14.000000000 +0400 +++ linux-2.6.8.1/kernel/pid.c 2006-06-02 18:12:21.000000000 +0400 @@ -470,7 +470,18 @@ int vpid_to_pid(int pid) static int add_mapping(int pid, int vpid, int veid, struct hlist_head *cache) { - if (pid > 0 && vpid > 0 && !__lookup_vpid_mapping(vpid, veid)) { + if (unlikely(pid <= 0 || vpid <= 0)) + return 0; + + /* VE can contain non-virtual (VE_ENTER'ed) processes when + * switching to sparse mapping. We should not create mappings + * for them. */ + if (unlikely(!__is_virtual_pid(vpid) && vpid != 1)) { + printk("DEBUG (do not worry, but report): non-virtual pid while switching mode %d %d\n", pid, vpid); + return 0; + } + + if (!__lookup_vpid_mapping(vpid, veid)) { struct vpid_mapping *m; if (hlist_empty(cache)) { m = kmem_cache_alloc(vpid_mapping_cachep, GFP_ATOMIC);