memremap.c (895749455f6054e0c7b40a6ec449a3ab6db51bdd) | memremap.c (dc90f0846df4870b6cc8528c31e5c60f18fb68be) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright(c) 2015 Intel Corporation. All rights reserved. */ 3#include <linux/device.h> 4#include <linux/io.h> 5#include <linux/kasan.h> 6#include <linux/memory_hotplug.h> | 1// SPDX-License-Identifier: GPL-2.0 2/* Copyright(c) 2015 Intel Corporation. All rights reserved. */ 3#include <linux/device.h> 4#include <linux/io.h> 5#include <linux/kasan.h> 6#include <linux/memory_hotplug.h> |
7#include <linux/mm.h> | 7#include <linux/memremap.h> |
8#include <linux/pfn_t.h> 9#include <linux/swap.h> 10#include <linux/mmzone.h> 11#include <linux/swapops.h> 12#include <linux/types.h> 13#include <linux/wait_bit.h> 14#include <linux/xarray.h> 15 --- 483 unchanged lines hidden (view full) --- 499 * to clear page->mapping. 500 */ 501 page->mapping = NULL; 502 page->pgmap->ops->page_free(page); 503} 504 505bool __put_devmap_managed_page(struct page *page) 506{ | 8#include <linux/pfn_t.h> 9#include <linux/swap.h> 10#include <linux/mmzone.h> 11#include <linux/swapops.h> 12#include <linux/types.h> 13#include <linux/wait_bit.h> 14#include <linux/xarray.h> 15 --- 483 unchanged lines hidden (view full) --- 499 * to clear page->mapping. 500 */ 501 page->mapping = NULL; 502 page->pgmap->ops->page_free(page); 503} 504 505bool __put_devmap_managed_page(struct page *page) 506{ |
507 if (page->pgmap->type != MEMORY_DEVICE_PRIVATE && 508 page->pgmap->type != MEMORY_DEVICE_FS_DAX) 509 return false; 510 |
|
507 /* 508 * devmap page refcounts are 1-based, rather than 0-based: if 509 * refcount is 1, then the page is free and the refcount is 510 * stable because nobody holds a reference on the page. 511 */ 512 switch (page_ref_dec_return(page)) { 513 case 1: 514 free_devmap_managed_page(page); 515 break; 516 case 0: 517 __put_page(page); 518 break; 519 } 520 return true; 521} 522EXPORT_SYMBOL(__put_devmap_managed_page); 523#endif /* CONFIG_DEV_PAGEMAP_OPS */ | 511 /* 512 * devmap page refcounts are 1-based, rather than 0-based: if 513 * refcount is 1, then the page is free and the refcount is 514 * stable because nobody holds a reference on the page. 515 */ 516 switch (page_ref_dec_return(page)) { 517 case 1: 518 free_devmap_managed_page(page); 519 break; 520 case 0: 521 __put_page(page); 522 break; 523 } 524 return true; 525} 526EXPORT_SYMBOL(__put_devmap_managed_page); 527#endif /* CONFIG_DEV_PAGEMAP_OPS */ |