-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There are several scenarios where we need to retrieve and update metadata associated with a given devm_memremap_pages() mapping, and the only lookup key available is a pfn in the range: 1/ We want to augment vmemmap_populate() (called via arch_add_memory()) to allocate memmap storage from pre-allocated pages reserved by the device driver. At vmemmap_alloc_block_buf() time it grabs device pages rather than page allocator pages. This is in support of devm_memremap_pages() mappings where the memmap is too large to fit in main memory (i.e. large persistent memory devices). 2/ Taking a reference against the mapping when inserting device pages into the address_space radix of a given inode. This facilitates unmap_mapping_range() and truncate_inode_pages() operations when the driver is tearing down the mapping. 3/ get_user_pages() operations on ZONE_DEVICE memory require taking a reference against the mapping so that the driver teardown path can revoke and drain usage of device pages. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Tested-by: Logan Gunthorpe <logang@deltatee.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Dave Chinner <david@fromorbit.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Loading branch information
Dan Williams
authored and
Linus Torvalds
committed
Jan 16, 2016
1 parent
260ae3f
commit 9476df7
Showing
4 changed files
with
116 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef _LINUX_MEMREMAP_H_ | ||
#define _LINUX_MEMREMAP_H_ | ||
#include <linux/mm.h> | ||
|
||
struct resource; | ||
struct device; | ||
/** | ||
* struct dev_pagemap - metadata for ZONE_DEVICE mappings | ||
* @dev: host device of the mapping for debug | ||
*/ | ||
struct dev_pagemap { | ||
/* TODO: vmem_altmap and percpu_ref count */ | ||
struct device *dev; | ||
}; | ||
|
||
#ifdef CONFIG_ZONE_DEVICE | ||
void *devm_memremap_pages(struct device *dev, struct resource *res); | ||
struct dev_pagemap *find_dev_pagemap(resource_size_t phys); | ||
#else | ||
static inline void *devm_memremap_pages(struct device *dev, | ||
struct resource *res) | ||
{ | ||
/* | ||
* Fail attempts to call devm_memremap_pages() without | ||
* ZONE_DEVICE support enabled, this requires callers to fall | ||
* back to plain devm_memremap() based on config | ||
*/ | ||
WARN_ON_ONCE(1); | ||
return ERR_PTR(-ENXIO); | ||
} | ||
|
||
static inline struct dev_pagemap *find_dev_pagemap(resource_size_t phys) | ||
{ | ||
return NULL; | ||
} | ||
#endif | ||
|
||
#endif /* _LINUX_MEMREMAP_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters