Call mm to set context for process.
Extract common codes to 'sync.c'.