Skip to content

Commit

Permalink
Merge pull request openucx#12 from hjelmn/linux_46_fix
Browse files Browse the repository at this point in the history
kernel: add support for Linux v4.6.x
  • Loading branch information
hjelmn authored Aug 29, 2017
2 parents b843014 + 0c6cab8 commit 5280087
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion kernel/xpmem_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
* Copyright 2010,2012 Cray Inc. All Rights Reserved
* Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
* reserved.
*/

Expand Down Expand Up @@ -294,7 +294,11 @@ xpmem_fault_handler(struct vm_area_struct *vma, struct vm_fault *vmf)
"%ld != %ld\n", old_pfn, pfn);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
put_page(pfn_to_page(pfn));
#else
page_cache_release(pfn_to_page(pfn));
#endif
atomic_dec(&seg->tg->n_pinned);
atomic_inc(&xpmem_my_part->n_unpinned);
goto out;
Expand Down
6 changes: 5 additions & 1 deletion kernel/xpmem_pfn.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
* Copyright 2009, 2014 Cray Inc. All Rights Reserved
* Copyright 2016 ARM Inc. All Rights Reserved
* Copyright (c) 2016 Nathan Hjelm <hjelmn@cs.unm.edu>
* Copyright (c) 2016-2017 Nathan Hjelm <hjelmn@cs.unm.edu>
*/

/*
Expand Down Expand Up @@ -264,7 +264,11 @@ xpmem_unpin_pages(struct xpmem_segment *seg, struct mm_struct *mm,
XPMEM_DEBUG("pfn=%llx, vaddr=%llx, n_pgs=%d",
pfn, vaddr, n_pgs);
page = virt_to_page(__va(pfn << PAGE_SHIFT));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
put_page(page);
#else
page_cache_release(page);
#endif
n_pgs_unpinned++;
vaddr += PAGE_SIZE;
n_pgs--;
Expand Down

0 comments on commit 5280087

Please sign in to comment.