Commit c10a520c authored by Ma Wupeng's avatar Ma Wupeng Committed by Wupeng Ma
Browse files

mm/hwpoison: introduce copy_mc_highpages

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8K5CO



--------------------------------

Commit 6efc7afb ("mm/hwpoison: introduce copy_mc_highpage") bring
mc support to copy_mc_highpage, however during huge page copy,
copy_mc_highpages is needed. intruduce copy_mc_highpages to
support huge page copy mc.

Signed-off-by: default avatarMa Wupeng <mawupeng1@huawei.com>
parent d689cd1c
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -418,12 +418,34 @@ static inline int copy_mc_highpage(struct page *to, struct page *from)
	return ret;
}
#endif

/* Return -EFAULT if there was a #MC during copy, otherwise 0 for success. */
static inline int copy_mc_highpages(struct page *to, struct page *from, int nr_pages)
{
	int ret = 0;
	int i;

	for (i = 0; i < nr_pages; i++) {
		cond_resched();
		ret = copy_mc_highpage(to + i, from + i);
		if (ret)
			return -EFAULT;
	}

	return ret;
}
#else
static inline int copy_mc_highpage(struct page *to, struct page *from)
{
	copy_highpage(to, from);
	return 0;
}

static inline int copy_mc_highpages(struct page *to, struct page *from, int nr_pages)
{
	copy_highpages(to, from, nr_pages);
	return 0;
}
#endif

#endif /* _LINUX_HIGHMEM_H */