forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Uplevel the pmem "region" ida to a global allocator
In preparation for handling platform differentiated memory types beyond persistent memory, uplevel the "region" identifier to a global number space. This enables a device-dax instance to be registered to any memory type with guaranteed unique names. Signed-off-by: Dan Williams <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
- Loading branch information
Showing
8 changed files
with
46 additions
and
11 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
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,19 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _MEMREGION_H_ | ||
#define _MEMREGION_H_ | ||
#include <linux/types.h> | ||
#include <linux/errno.h> | ||
|
||
#ifdef CONFIG_MEMREGION | ||
int memregion_alloc(gfp_t gfp); | ||
void memregion_free(int id); | ||
#else | ||
static inline int memregion_alloc(gfp_t gfp) | ||
{ | ||
return -ENOMEM; | ||
} | ||
void memregion_free(int id) | ||
{ | ||
} | ||
#endif | ||
#endif /* _MEMREGION_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
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,18 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* identifiers for device / performance-differentiated memory regions */ | ||
#include <linux/idr.h> | ||
#include <linux/types.h> | ||
|
||
static DEFINE_IDA(memregion_ids); | ||
|
||
int memregion_alloc(gfp_t gfp) | ||
{ | ||
return ida_alloc(&memregion_ids, gfp); | ||
} | ||
EXPORT_SYMBOL(memregion_alloc); | ||
|
||
void memregion_free(int id) | ||
{ | ||
ida_free(&memregion_ids, id); | ||
} | ||
EXPORT_SYMBOL(memregion_free); |