Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lguest: move process freezing before pending signals check

run_guest tries to freeze the current process after it has handled
pending interrupts and before it calls lguest_arch_run_guest.
This doesn't work nicely if the task has been killed while being frozen
and when we want to handle that signal as soon as possible.
Let's move try_to_freeze before we check for pending signal so that we
can get out of the loop as soon as possible.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

authored by

Michal Hocko and committed by
Rusty Russell
0acf0001 89cfc991

+7 -7
+7 -7
drivers/lguest/core.c
··· 232 232 } 233 233 } 234 234 235 + /* 236 + * All long-lived kernel loops need to check with this horrible 237 + * thing called the freezer. If the Host is trying to suspend, 238 + * it stops us. 239 + */ 240 + try_to_freeze(); 241 + 235 242 /* Check for signals */ 236 243 if (signal_pending(current)) 237 244 return -ERESTARTSYS; ··· 251 244 irq = interrupt_pending(cpu, &more); 252 245 if (irq < LGUEST_IRQS) 253 246 try_deliver_interrupt(cpu, irq, more); 254 - 255 - /* 256 - * All long-lived kernel loops need to check with this horrible 257 - * thing called the freezer. If the Host is trying to suspend, 258 - * it stops us. 259 - */ 260 - try_to_freeze(); 261 247 262 248 /* 263 249 * Just make absolutely sure the Guest is still alive. One of