hugetlb_cgroup-add-accounting-for-shared-mappings.patch removed from -mm tree
The patch titled
Subject: hugetlb_cgroup: add accounting for shared mappings
has been removed from the -mm tree. Its filename was
hugetlb_cgroup-add-accounting-for-shared-mappings.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Mina Almasry <[email protected]>
Subject: hugetlb_cgroup: add accounting for shared mappings
For shared mappings, the pointer to the hugetlb_cgroup to uncharge lives in the resv_map entries, in file_region->reservation_counter.
After a call to region_chg, we charge the approprate hugetlb_cgroup, and if successful, we pass on the hugetlb_cgroup info to a follow up region_add call. When a file_region entry is added to the resv_map via region_add, we put the pointer to that cgroup in file_region->reservation_counter. If charging doesn't succeed, we report the error to the caller, so that the kernel fails the reservation.
On region_del, which is when the hugetlb memory is unreserved, we also uncharge the file_region->reservation_counter.
---
include/linux/hugetlb.h | 35 +++++++ include/linux/hugetlb_cgroup.h | 11 ++ mm/hugetlb.c | 148 +++++++++++++++++++------------ mm/hugetlb_cgroup.c | 15 +++ 4 files changed, 155 insertions(+), 54 deletions(-)
include/linux/hugetlb_cgroup.h renamed from include/linux/hugetlb_cgroup.h~hugetlb_cgroup-add-accounting-for-shared-mappings +11 -0
@@ -19,6 +19,7 @@struct hugetlb_cgroup ;struct resv_map ; +struct file_region ;/* * Minimum page order trackable by hugetlb cgroup.
@@ -135,11 +136,21 @@ extern void hugetlb_cgroup_uncharge_coununsigned long start, unsigned long end); +extern void hugetlb_cgroup_uncharge_file_region (struct resv_map *resv, +struct file_region *rg, +unsigned long nr_pages); +extern void hugetlb_cgroup_file_init (void )__init ;extern void hugetlb_cgroup_migrate (struct page *oldhpage,struct page *newhpage);#else +static inline void hugetlb_cgroup_uncharge_file_region (struct resv_map *resv, +struct file_region *rg, +unsigned long nr_pages) +{ +} +static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page (struct page *page) {return NULL ;
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~hugetlb_cgroup-add-accounting-for-shared-mappings +35 -0
@@ -57,6 +57,41 @@ struct resv_map {struct cgroup_subsys_state *css;#endif }; + +/* +* Region tracking -- allows tracking of reservations and instantiated pages +* across the pages in a mapping. +* +* The region data structures are embedded into a resv_map and protected +* by a resv_map's lock. The set of regions within the resv_map represent +* reservations for huge pages, or huge pages that have already been +* instantiated within the map. The from and to elements are huge page +* indicies into the associated mapping. from indicates the starting index +* of the region. to represents the first index past the end of the region. +* +* For example, a file region structure with from == 0 and to == 4 represents +* four huge pages in a mapping. It is important to note that the to element +* represents the first element past the end of the region. This is used in +* arithmetic as 4(to) - 0(from) = 4 huge pages in the region. +* +* Interval notation of the form [from, to) will be used to indicate that +* the endpoint from is inclusive and to is exclusive. +*/ +struct file_region { +struct list_head link; +long from; +long to; +#ifdef CONFIG_CGROUP_HUGETLB +/* +* On shared mappings, each reserved region appears as a struct +* file_region in resv_map. These fields hold the info needed to +* uncharge each reservation. +*/ +struct page_counter *reservation_counter; +struct cgroup_subsys_state *css; +#endif +}; +extern struct resv_map *resv_map_alloc (void );void resv_map_release (struct kref *ref);
mm/hugetlb.c renamed from mm/hugetlb.c~hugetlb_cgroup-add-accounting-for-shared-mappings +94 -54
291 lines not on this page · raw message
mm/hugetlb_cgroup.c renamed from mm/hugetlb_cgroup.c~hugetlb_cgroup-add-accounting-for-shared-mappings +15 -0
@@ -391,6 +391,21 @@ void hugetlb_cgroup_uncharge_counter(strcss_put (resv->css); } +void hugetlb_cgroup_uncharge_file_region (struct resv_map *resv, +struct file_region *rg, +unsigned long nr_pages) +{ +if (hugetlb_cgroup_disabled () || !resv || !rg || !nr_pages) +return ; + +if (rg->reservation_counter && resv->pages_per_hpage && nr_pages >0 && + !resv->reservation_counter) { +page_counter_uncharge (rg->reservation_counter, + nr_pages * resv->pages_per_hpage); +css_put (rg->css); + } +} +enum {RES_USAGE ,RES_RSVD_USAGE ,
_
Patches currently in -mm which might be from [email protected] are