Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1698327
| Path | csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Matthias Kaehlcke <mka@chromium.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] mm: memcontrol: Use int for event/state parameter in several functions |
| Date | Thu, 27 Jul 2017 23:20:01 +0200 |
| Message-ID | <u7Yml-2WL-3@gated-at.bofh.it> (permalink) |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YZ4wRFpPLrZuDxcdlg3VPwOYOySdXyV6xOHDkJelegA=; b=JEmKZgCAFor0prS+HHgv/Habv5aF4A0T+wM7ZufhsDvK5Vo6rb9tKjn2HPdCKuWNnn bQDB/J4VGF+4bDDf3p6EV61j4VC6zVgGDag0KdawnF4rER6Yf7ONNcux3AGQHl2w/MSh uhVJ+opsx4gShnkKrEE6yPryHJ6Q9c3tc+ycN6JJRjnCbwHlBGErSIkkvC7ktzDxa8Yy mMiEWgjbevSGVp7LHLkIP3AaILemlymSZ0QnnnDlppuPllpLhfvJ/MR3l3sSullkwAhL 1hZb4zu0RpUbmGrsknk5uFNOHsyG0o6G7Zwt5xZ0F1INZj8YchTjGlA7bNpdefWUfyMf 7aMg== |
| X-Gm-Message-State | AIVw1129KqMDIZfo/ZlefJ0PVCMxqYp2EuK53+ss41rE63AbNBu97RCT XNBYT4x5t3S0+22R |
| X-Received | by 10.98.71.200 with SMTP id p69mr5259935pfi.296.1501189815293; Thu, 27 Jul 2017 14:10:15 -0700 (PDT) |
| X-Mailer | git-send-email 2.14.0.rc0.400.g1c36432dff-goog |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 112 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Doug Anderson <dianders@chromium.org>, Matthias Kaehlcke <mka@chromium.org> |
| X-Original-Date | Thu, 27 Jul 2017 14:10:04 -0700 |
| X-Original-Message-ID | <20170727211004.34435-1-mka@chromium.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1698327 |
Show key headers only | View raw
Several functions use an enum type as parameter for an event/state,
but are called in some locations with an argument of a different enum
type. Adjust the interface of these functions to reality by changing the
parameter to int.
This fixes a ton of enum-conversion warnings that are generated when
building the kernel with clang.
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
include/linux/memcontrol.h | 20 ++++++++++++--------
mm/memcontrol.c | 4 +++-
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 3914e3dd6168..80edbc04361e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -487,8 +487,9 @@ extern int do_swap_account;
void lock_page_memcg(struct page *page);
void unlock_page_memcg(struct page *page);
+/* idx can be of type enum memcg_stat_item or node_stat_item */
static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
- enum memcg_stat_item idx)
+ int idx)
{
long val = 0;
int cpu;
@@ -502,15 +503,17 @@ static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
return val;
}
+/* idx can be of type enum memcg_stat_item or node_stat_item */
static inline void __mod_memcg_state(struct mem_cgroup *memcg,
- enum memcg_stat_item idx, int val)
+ int idx, int val)
{
if (!mem_cgroup_disabled())
__this_cpu_add(memcg->stat->count[idx], val);
}
+/* idx can be of type enum memcg_stat_item or node_stat_item */
static inline void mod_memcg_state(struct mem_cgroup *memcg,
- enum memcg_stat_item idx, int val)
+ int idx, int val)
{
if (!mem_cgroup_disabled())
this_cpu_add(memcg->stat->count[idx], val);
@@ -631,8 +634,9 @@ static inline void count_memcg_events(struct mem_cgroup *memcg,
this_cpu_add(memcg->stat->events[idx], count);
}
+/* idx can be of type enum memcg_stat_item or node_stat_item */
static inline void count_memcg_page_event(struct page *page,
- enum memcg_stat_item idx)
+ int idx)
{
if (page->mem_cgroup)
count_memcg_events(page->mem_cgroup, idx, 1);
@@ -840,19 +844,19 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
}
static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
- enum memcg_stat_item idx)
+ int idx)
{
return 0;
}
static inline void __mod_memcg_state(struct mem_cgroup *memcg,
- enum memcg_stat_item idx,
+ int idx,
int nr)
{
}
static inline void mod_memcg_state(struct mem_cgroup *memcg,
- enum memcg_stat_item idx,
+ int idx,
int nr)
{
}
@@ -918,7 +922,7 @@ static inline void count_memcg_events(struct mem_cgroup *memcg,
}
static inline void count_memcg_page_event(struct page *page,
- enum memcg_stat_item idx)
+ int idx)
{
}
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3df3c04d73ab..460130d2a796 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -550,10 +550,12 @@ mem_cgroup_largest_soft_limit_node(struct mem_cgroup_tree_per_node *mctz)
* value, and reading all cpu value can be performance bottleneck in some
* common workload, threshold and synchronization as vmstat[] should be
* implemented.
+ *
+ * The parameter idx can be of type enum memcg_event_item or vm_event_item.
*/
static unsigned long memcg_sum_events(struct mem_cgroup *memcg,
- enum memcg_event_item event)
+ int event)
{
unsigned long val = 0;
int cpu;
--
2.14.0.rc0.400.g1c36432dff-goog
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] mm: memcontrol: Use int for event/state parameter in several functions Matthias Kaehlcke <mka@chromium.org> - 2017-07-27 23:20 +0200
Re: [PATCH] mm: memcontrol: Use int for event/state parameter in several functions Michal Hocko <mhocko@kernel.org> - 2017-07-28 09:00 +0200
Re: [PATCH] mm: memcontrol: Use int for event/state parameter in several functions Matthias Kaehlcke <mka@chromium.org> - 2017-07-28 20:30 +0200
Re: [PATCH] mm: memcontrol: Use int for event/state parameter in several functions Johannes Weiner <hannes@cmpxchg.org> - 2017-07-28 22:00 +0200
csiph-web