* [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP
@ 2020-03-04 14:23 Vincenzo Frascino
[not found] ` <20200304142348.48167-1-vincenzo.frascino-5wv7dgnIgG8@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Vincenzo Frascino @ 2020-03-04 14:23 UTC (permalink / raw)
To: cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Vincenzo Frascino, Johannes Weiner, Michal Hocko,
Vladimir Davydov, Andrew Morton
mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP
configuration options are enabled. Having them disabled triggers the
following warning at compile time:
linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined
but not used [-Wunused-function]
static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned
int n)
Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address
the issue.
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Vladimir Davydov <vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino-5wv7dgnIgG8@public.gmane.org>
---
mm/memcontrol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d09776cd6e10..628cebeb4bdd 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4794,10 +4794,12 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg)
}
}
+#if defined(CONFIG_MEMCG_SWAP) || defined(CONFIG_MMU)
static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n)
{
refcount_add(n, &memcg->id.ref);
}
+#endif
static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread[parent not found: <20200304142348.48167-1-vincenzo.frascino-5wv7dgnIgG8@public.gmane.org>]
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP [not found] ` <20200304142348.48167-1-vincenzo.frascino-5wv7dgnIgG8@public.gmane.org> @ 2020-03-04 16:53 ` Michal Hocko [not found] ` <20200304165336.GO16139-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Michal Hocko @ 2020-03-04 16:53 UTC (permalink / raw) To: Vincenzo Frascino Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Johannes Weiner, Vladimir Davydov, Andrew Morton On Wed 04-03-20 14:23:48, Vincenzo Frascino wrote: > mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP > configuration options are enabled. Having them disabled triggers the > following warning at compile time: > > linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined > but not used [-Wunused-function] > static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned > int n) > > Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address > the issue. A similar patch has been proposed recently http://lkml.kernel.org/r/87fthjh2ib.wl-kuninori.morimoto.gx-zM6kxYcvzFDowKkBSvOlow@public.gmane.org The conclusion was that the warning is not really worth adding code. > Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> > Cc: Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: Vladimir Davydov <vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> > Signed-off-by: Vincenzo Frascino <vincenzo.frascino-5wv7dgnIgG8@public.gmane.org> > --- > mm/memcontrol.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index d09776cd6e10..628cebeb4bdd 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -4794,10 +4794,12 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg) > } > } > > +#if defined(CONFIG_MEMCG_SWAP) || defined(CONFIG_MMU) > static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n) > { > refcount_add(n, &memcg->id.ref); > } > +#endif > > static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n) > { > -- > 2.25.1 -- Michal Hocko SUSE Labs ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20200304165336.GO16139-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>]
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP [not found] ` <20200304165336.GO16139-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org> @ 2020-03-05 9:49 ` Vincenzo Frascino [not found] ` <8c489836-b824-184e-7cfe-25e55ab73000-5wv7dgnIgG8@public.gmane.org> 2020-03-05 16:09 ` Johannes Weiner 0 siblings, 2 replies; 9+ messages in thread From: Vincenzo Frascino @ 2020-03-05 9:49 UTC (permalink / raw) To: Michal Hocko Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Johannes Weiner, Vladimir Davydov, Andrew Morton Hi Michal, On 3/4/20 4:53 PM, Michal Hocko wrote: > On Wed 04-03-20 14:23:48, Vincenzo Frascino wrote: >> mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP >> configuration options are enabled. Having them disabled triggers the >> following warning at compile time: >> >> linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined >> but not used [-Wunused-function] >> static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned >> int n) >> >> Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address >> the issue. > > A similar patch has been proposed recently > http://lkml.kernel.org/r/87fthjh2ib.wl-kuninori.morimoto.gx-zM6kxYcvzFDowKkBSvOlow@public.gmane.org > The conclusion was that the warning is not really worth adding code. > Thank you for pointing this out, I was not aware of it. I understand that you are against "#ifdeffery" in this case, but isn't it the case of adding at least __maybe_unused? This would prevent people from reporting it over and over again and you to have to push them back :) Let me know what do you think, in case I am happy to change my patch accordingly. [...] -- Regards, Vincenzo ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <8c489836-b824-184e-7cfe-25e55ab73000-5wv7dgnIgG8@public.gmane.org>]
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP [not found] ` <8c489836-b824-184e-7cfe-25e55ab73000-5wv7dgnIgG8@public.gmane.org> @ 2020-03-05 10:00 ` Michal Hocko 2020-03-05 10:46 ` Vincenzo Frascino 0 siblings, 1 reply; 9+ messages in thread From: Michal Hocko @ 2020-03-05 10:00 UTC (permalink / raw) To: Vincenzo Frascino Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Johannes Weiner, Vladimir Davydov, Andrew Morton On Thu 05-03-20 09:49:23, Vincenzo Frascino wrote: > Hi Michal, > > On 3/4/20 4:53 PM, Michal Hocko wrote: > > On Wed 04-03-20 14:23:48, Vincenzo Frascino wrote: > >> mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP > >> configuration options are enabled. Having them disabled triggers the > >> following warning at compile time: > >> > >> linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined > >> but not used [-Wunused-function] > >> static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned > >> int n) > >> > >> Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address > >> the issue. > > > > A similar patch has been proposed recently > > http://lkml.kernel.org/r/87fthjh2ib.wl-kuninori.morimoto.gx-zM6kxYcvzFDowKkBSvOlow@public.gmane.org > > The conclusion was that the warning is not really worth adding code. > > > > Thank you for pointing this out, I was not aware of it. I understand that you > are against "#ifdeffery" in this case, but isn't it the case of adding at least > __maybe_unused? This would prevent people from reporting it over and over again > and you to have to push them back :) Let me know what do you think, in case I am > happy to change my patch accordingly. We have discussed __maybe_unused in the email thread as well. I am not a great fan of that as mentioed there. -- Michal Hocko SUSE Labs ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP 2020-03-05 10:00 ` Michal Hocko @ 2020-03-05 10:46 ` Vincenzo Frascino [not found] ` <acf13158-40a3-4027-f36a-25d24efe3242-5wv7dgnIgG8@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Vincenzo Frascino @ 2020-03-05 10:46 UTC (permalink / raw) To: Michal Hocko Cc: cgroups, linux-mm, linux-kernel, Johannes Weiner, Vladimir Davydov, Andrew Morton Hi Michal, On 3/5/20 10:00 AM, Michal Hocko wrote: > On Thu 05-03-20 09:49:23, Vincenzo Frascino wrote: >> Hi Michal, >> >> On 3/4/20 4:53 PM, Michal Hocko wrote: >>> On Wed 04-03-20 14:23:48, Vincenzo Frascino wrote: >>>> mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP >>>> configuration options are enabled. Having them disabled triggers the >>>> following warning at compile time: >>>> >>>> linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined >>>> but not used [-Wunused-function] >>>> static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned >>>> int n) >>>> >>>> Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address >>>> the issue. >>> >>> A similar patch has been proposed recently >>> http://lkml.kernel.org/r/87fthjh2ib.wl-kuninori.morimoto.gx@renesas.com. >>> The conclusion was that the warning is not really worth adding code. >>> >> >> Thank you for pointing this out, I was not aware of it. I understand that you >> are against "#ifdeffery" in this case, but isn't it the case of adding at least >> __maybe_unused? This would prevent people from reporting it over and over again >> and you to have to push them back :) Let me know what do you think, in case I am >> happy to change my patch accordingly. > > We have discussed __maybe_unused in the email thread as well. I am not a > great fan of that as mentioed there. > I am aware of this. I was just exploring if there was a possibility of addressing the warning, since if we leave all the warnings in scenarios like randconfig can cause confusion in between real and non real issues. Is there anything we can do? -- Regards, Vincenzo ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <acf13158-40a3-4027-f36a-25d24efe3242-5wv7dgnIgG8@public.gmane.org>]
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP [not found] ` <acf13158-40a3-4027-f36a-25d24efe3242-5wv7dgnIgG8@public.gmane.org> @ 2020-03-05 14:18 ` Michal Hocko 0 siblings, 0 replies; 9+ messages in thread From: Michal Hocko @ 2020-03-05 14:18 UTC (permalink / raw) To: Vincenzo Frascino Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Johannes Weiner, Vladimir Davydov, Andrew Morton On Thu 05-03-20 10:46:21, Vincenzo Frascino wrote: [...] > I am aware of this. I was just exploring if there was a possibility of > addressing the warning, since if we leave all the warnings in scenarios like > randconfig can cause confusion in between real and non real issues. I would very much like to address _real_ warnings. This one is just bugus. I do not see a fix that would be sensible. Wrapping the helper by ifdefs is just going to make the resulting code worse because there is nothing really specific to swap there. Marking it __maybe_unused will just paper over the report and allow the function to bitrot when it is not used anymore. So for now I would just live with the warning unless it is really causing any real problems. -- Michal Hocko SUSE Labs ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP 2020-03-05 9:49 ` Vincenzo Frascino [not found] ` <8c489836-b824-184e-7cfe-25e55ab73000-5wv7dgnIgG8@public.gmane.org> @ 2020-03-05 16:09 ` Johannes Weiner 2020-03-05 16:21 ` Vincenzo Frascino [not found] ` <20200305160929.GA1166-druUgvl0LCNAfugRpC6u6w@public.gmane.org> 1 sibling, 2 replies; 9+ messages in thread From: Johannes Weiner @ 2020-03-05 16:09 UTC (permalink / raw) To: Vincenzo Frascino Cc: Michal Hocko, cgroups, linux-mm, linux-kernel, Vladimir Davydov, Andrew Morton On Thu, Mar 05, 2020 at 09:49:23AM +0000, Vincenzo Frascino wrote: > Hi Michal, > > On 3/4/20 4:53 PM, Michal Hocko wrote: > > On Wed 04-03-20 14:23:48, Vincenzo Frascino wrote: > >> mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP > >> configuration options are enabled. Having them disabled triggers the > >> following warning at compile time: > >> > >> linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined > >> but not used [-Wunused-function] > >> static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned > >> int n) > >> > >> Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address > >> the issue. > > > > A similar patch has been proposed recently > > http://lkml.kernel.org/r/87fthjh2ib.wl-kuninori.morimoto.gx@renesas.com. > > The conclusion was that the warning is not really worth adding code. > > > > Thank you for pointing this out, I was not aware of it. I understand that you > are against "#ifdeffery" in this case, but isn't it the case of adding at least > __maybe_unused? This would prevent people from reporting it over and over again > and you to have to push them back :) Let me know what do you think, in case I am > happy to change my patch accordingly. I would ack a patch that adds __maybe_unused. This is a tiny function. If we keep it around a few releases after removing the last user, it costs us absolutely nothing. Eventually somebody will notice and send a patch to remove it. No big deal. There is, however, real cost in keeping bogus warnings around and telling people to ignore them. It's actively lowering the signal-to-noise ratio and normalizing warnings to developers. That's the kind of thing that will actually hide problems in the kernel. We know that the function can be unused in certain scenarios. It's silly to let the compiler continue to warn about it. That's exactly what __maybe_unused is for, so let's use it here. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP 2020-03-05 16:09 ` Johannes Weiner @ 2020-03-05 16:21 ` Vincenzo Frascino [not found] ` <20200305160929.GA1166-druUgvl0LCNAfugRpC6u6w@public.gmane.org> 1 sibling, 0 replies; 9+ messages in thread From: Vincenzo Frascino @ 2020-03-05 16:21 UTC (permalink / raw) To: Johannes Weiner Cc: Michal Hocko, cgroups, linux-mm, linux-kernel, Vladimir Davydov, Andrew Morton Hi Johannes, On 3/5/20 4:09 PM, Johannes Weiner wrote: > On Thu, Mar 05, 2020 at 09:49:23AM +0000, Vincenzo Frascino wrote: >> Hi Michal, >> >> On 3/4/20 4:53 PM, Michal Hocko wrote: >>> On Wed 04-03-20 14:23:48, Vincenzo Frascino wrote: >>>> mem_cgroup_id_get_many() is currently used only when MMU or MEMCG_SWAP >>>> configuration options are enabled. Having them disabled triggers the >>>> following warning at compile time: >>>> >>>> linux/mm/memcontrol.c:4797:13: warning: ‘mem_cgroup_id_get_many’ defined >>>> but not used [-Wunused-function] >>>> static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned >>>> int n) >>>> >>>> Make mem_cgroup_id_get_many() dependent on MMU and MEMCG_SWAP to address >>>> the issue. >>> >>> A similar patch has been proposed recently >>> http://lkml.kernel.org/r/87fthjh2ib.wl-kuninori.morimoto.gx@renesas.com. >>> The conclusion was that the warning is not really worth adding code. >>> >> >> Thank you for pointing this out, I was not aware of it. I understand that you >> are against "#ifdeffery" in this case, but isn't it the case of adding at least >> __maybe_unused? This would prevent people from reporting it over and over again >> and you to have to push them back :) Let me know what do you think, in case I am >> happy to change my patch accordingly. > > I would ack a patch that adds __maybe_unused. > > This is a tiny function. If we keep it around a few releases after > removing the last user, it costs us absolutely nothing. Eventually > somebody will notice and send a patch to remove it. No big deal. > > There is, however, real cost in keeping bogus warnings around and > telling people to ignore them. It's actively lowering the > signal-to-noise ratio and normalizing warnings to developers. That's > the kind of thing that will actually hide problems in the kernel. > > We know that the function can be unused in certain scenarios. It's > silly to let the compiler continue to warn about it. That's exactly > what __maybe_unused is for, so let's use it here. > I agree with what you are saying. I am going to change my patch accordingly. Thank you. -- Regards, Vincenzo ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20200305160929.GA1166-druUgvl0LCNAfugRpC6u6w@public.gmane.org>]
* Re: [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP [not found] ` <20200305160929.GA1166-druUgvl0LCNAfugRpC6u6w@public.gmane.org> @ 2020-03-05 18:34 ` Chris Down 0 siblings, 0 replies; 9+ messages in thread From: Chris Down @ 2020-03-05 18:34 UTC (permalink / raw) To: Johannes Weiner Cc: Vincenzo Frascino, Michal Hocko, cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Vladimir Davydov, Andrew Morton Johannes Weiner writes: >I would ack a patch that adds __maybe_unused. > >This is a tiny function. If we keep it around a few releases after >removing the last user, it costs us absolutely nothing. Eventually >somebody will notice and send a patch to remove it. No big deal. > >There is, however, real cost in keeping bogus warnings around and >telling people to ignore them. It's actively lowering the >signal-to-noise ratio and normalizing warnings to developers. That's >the kind of thing that will actually hide problems in the kernel. > >We know that the function can be unused in certain scenarios. It's >silly to let the compiler continue to warn about it. That's exactly >what __maybe_unused is for, so let's use it here. Yeah, this is exactly what I was trying to express in the first one[0]. The fact that this patch came around a second time, as expected, just solidifies my concern around the waste to human time. I would also ack a patch that adds __maybe_unused. 0: https://lore.kernel.org/linux-mm/20191217143720.GB131030-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org/ ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-03-05 18:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-04 14:23 [PATCH] mm: Make mem_cgroup_id_get_many dependent on MMU and MEMCG_SWAP Vincenzo Frascino
[not found] ` <20200304142348.48167-1-vincenzo.frascino-5wv7dgnIgG8@public.gmane.org>
2020-03-04 16:53 ` Michal Hocko
[not found] ` <20200304165336.GO16139-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-03-05 9:49 ` Vincenzo Frascino
[not found] ` <8c489836-b824-184e-7cfe-25e55ab73000-5wv7dgnIgG8@public.gmane.org>
2020-03-05 10:00 ` Michal Hocko
2020-03-05 10:46 ` Vincenzo Frascino
[not found] ` <acf13158-40a3-4027-f36a-25d24efe3242-5wv7dgnIgG8@public.gmane.org>
2020-03-05 14:18 ` Michal Hocko
2020-03-05 16:09 ` Johannes Weiner
2020-03-05 16:21 ` Vincenzo Frascino
[not found] ` <20200305160929.GA1166-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2020-03-05 18:34 ` Chris Down
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox