Skip to content

Commit

Permalink
Merge branch 'tsahee-kmap-atomic'
Browse files Browse the repository at this point in the history
  • Loading branch information
kd8bny committed Mar 21, 2021
2 parents a19344f + e1c841a commit 9c73477
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lime.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
#define LIME_SUPPORTS_TIMING
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
#define LIME_USE_KMAP_ATOMIC
#endif

#ifdef CONFIG_ZLIB_DEFLATE
#define LIME_SUPPORTS_DEFLATE
#endif
Expand Down
9 changes: 8 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ static void write_range(struct resource * res) {
DBG("Padding partial page: vaddr %p size: %lu", (void *) i, (unsigned long) is);
write_padding(is);
} else {
#ifdef LIME_USE_KMAP_ATOMIC
v = kmap_atomic(p);
#else
v = kmap(p);
#endif
/*
* If we need to compute the digest or compress the output
* take a snapshot of the page. Otherwise save some cycles.
Expand All @@ -299,8 +303,11 @@ static void write_range(struct resource * res) {
} else {
s = write_vaddr(v, is);
}
#ifdef LIME_USE_KMAP_ATOMIC
kunmap_atomic(v);
#else
kunmap(p);

#endif
if (s < 0) {
DBG("Failed to write page: vaddr %p. Skipping Range...", v);
break;
Expand Down

0 comments on commit 9c73477

Please sign in to comment.