yesod: refactor allocator helper and policy

Signed-off-by: Alex Dubov <oakad@yahoo.com>