Skip to content

Commit 93397c3

Browse files
Hugh Dickinsakpm00
authored andcommitted
mempolicy trivia: use pgoff_t in shared mempolicy tree
Prefer the more explicit "pgoff_t" to "unsigned long" when dealing with a shared mempolicy tree. Delete confusing comment about pseudo mm vmas. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Hugh Dickins <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "Huang, Ying" <[email protected]> Cc: Kefeng Wang <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Nhat Pham <[email protected]> Cc: Sidhartha Kumar <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Tejun heo <[email protected]> Cc: Vishal Moola (Oracle) <[email protected]> Cc: Yang Shi <[email protected]> Cc: Yosry Ahmed <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent c36f6e6 commit 93397c3

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

include/linux/mempolicy.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,30 +105,24 @@ static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
105105

106106
/*
107107
* Tree of shared policies for a shared memory region.
108-
* Maintain the policies in a pseudo mm that contains vmas. The vmas
109-
* carry the policy. As a special twist the pseudo mm is indexed in pages, not
110-
* bytes, so that we can work with shared memory segments bigger than
111-
* unsigned long.
112108
*/
113-
114-
struct sp_node {
115-
struct rb_node nd;
116-
unsigned long start, end;
117-
struct mempolicy *policy;
118-
};
119-
120109
struct shared_policy {
121110
struct rb_root root;
122111
rwlock_t lock;
123112
};
113+
struct sp_node {
114+
struct rb_node nd;
115+
pgoff_t start, end;
116+
struct mempolicy *policy;
117+
};
124118

125119
int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst);
126120
void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
127121
int mpol_set_shared_policy(struct shared_policy *sp,
128122
struct vm_area_struct *vma, struct mempolicy *mpol);
129123
void mpol_free_shared_policy(struct shared_policy *sp);
130124
struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
131-
unsigned long idx);
125+
pgoff_t idx);
132126

133127
struct mempolicy *get_task_policy(struct task_struct *p);
134128
struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
@@ -214,7 +208,7 @@ static inline void mpol_free_shared_policy(struct shared_policy *sp)
214208
}
215209

216210
static inline struct mempolicy *
217-
mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
211+
mpol_shared_policy_lookup(struct shared_policy *sp, pgoff_t idx)
218212
{
219213
return NULL;
220214
}

mm/mempolicy.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,8 +2428,8 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
24282428
* lookup first element intersecting start-end. Caller holds sp->lock for
24292429
* reading or for writing
24302430
*/
2431-
static struct sp_node *
2432-
sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
2431+
static struct sp_node *sp_lookup(struct shared_policy *sp,
2432+
pgoff_t start, pgoff_t end)
24332433
{
24342434
struct rb_node *n = sp->root.rb_node;
24352435

@@ -2483,8 +2483,8 @@ static void sp_insert(struct shared_policy *sp, struct sp_node *new)
24832483
}
24842484

24852485
/* Find shared policy intersecting idx */
2486-
struct mempolicy *
2487-
mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
2486+
struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
2487+
pgoff_t idx)
24882488
{
24892489
struct mempolicy *pol = NULL;
24902490
struct sp_node *sn;
@@ -2652,8 +2652,8 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
26522652
}
26532653

26542654
/* Replace a policy range. */
2655-
static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2656-
unsigned long end, struct sp_node *new)
2655+
static int shared_policy_replace(struct shared_policy *sp, pgoff_t start,
2656+
pgoff_t end, struct sp_node *new)
26572657
{
26582658
struct sp_node *n;
26592659
struct sp_node *n_new = NULL;

0 commit comments

Comments
 (0)