mm/lib: rewrote create_same_memory()

create_same_memory() was too large and contained lots of duplicated codes,
and it's a little hard-coding, so that it's not easy to read and
extend it for new case.

I splited it for five sub-functions:

  ksm_child_memset();
  create_ksm_child();
  stop_ksm_children();
  resume_ksm_children();
  create_smae_memory();

Also I intruduced a data struct to control the mergeable data:

  struct ksm_merge_data {
        char data;
        int mergeable_size;
  };

Signed-off-by: Zhouping Liu <zliu@redhat.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2 files changed