Skip to contentSkip to conversation

query about usage of kmap_atomic

DISCUSSION Fan Li 1 participant 1 message Sep 16, 2016

lore
Share & tools
lore

Fan Li

author
#0 lore raw

In f2fs_copy_page, kmap is used, rather than kmap_atomic, while some codes in mm directory use kmap_atomic in scenarios where a whole page is copied.

How to determine which is better? I searched online and only thing I found is that "code which holds kmap_atomic needs be short and simple".

So is there any kind of guideline about how to use such function that will disable preemption?
Thanks.

static inline void f2fs_copy_page(struct page *src, struct page *dst)

{
	char *src_kaddr = kmap(src);
	char *dst_kaddr = kmap(dst);

	memcpy(dst_kaddr, src_kaddr, PAGE_SIZE);
	kunmap(dst);
	kunmap(src);
}

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