proc: simplify and correct proc_flush_task