SYNC KERNEL code from 3.9.y