[RESEND RFC PATCH v1 12/20] mm: add ksm_merge_type() function