Hi Huge,
On Tue, Aug 10, 2021 at 02:35:05PM -0700, Hugh Dickins wrote:
On Tue, 10 Aug 2021, Feng Tang wrote:
quoted
On Mon, Aug 09, 2021 at 03:19:32PM +0200, Michal Hocko wrote:
[snip]
quoted
quoted
quoted
Do you think you can provide same helpers for other policies as well?
Maybe we can get rid of some other ifdefery as well.
Sure. I can make separate patch(es) for that.
And you mean helper like mpol_is_bind/default/local/preferred?
I just run 'git-grep MPOL', and for places using "mode == MPOL_XXX",
mostly they are in mempolicy.[ch], the only another place is in
shmem.c, do we need to create all the helpers for it and the
potential future users?
I would just go with those instances which need to ifdef for NUMA.
Thanks!
Yes, following is a patch to remove one CONFIG_NUMA check, though
an bolder idea to extend the patch by removing the CONFIG_TMPFS
check in the same line.
Thanks,
Feng
---------8<---------------------------------
From 1a5858721ac8ce99c27c13d310bba2983dc73d97 Mon Sep 17 00:00:00 2001
From: Feng Tang <redacted>
Date: Tue, 10 Aug 2021 17:00:59 +0800
Subject: [PATCH] mm: shmem: avoid open coded check for mempolicy's mode
Add a mempolicy helper to do the check, which can also remove
a CONFIG_NUMA option check.
Suggested-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Feng Tang <redacted>
No thanks: this is not an improvement.
The "#if defined(CONFIG_NUMA) && defined(CONFIG_TMPFS)" is there to
eliminate dead code that would not be automatically eliminated by the
optimizer: it's not there just to avoid MPOL_DEFAULT, and it's there
to cover shmem_get_sbmpol() along with shmem_show_mpol().
Thanks for the explaination! I did some tests that in !NUMA case, the
'sbinfo->mpol' is always NULL (I could be wrong) which makes the
2 functions almost non-ops.
I know we tend to avoid #ifdefs in .c files, and that's good; and
I know you could find other code in mm/shmem.c which might also be
#ifdef'ed to eliminate other dead code in other configs; but unless
there's a new drive to purge our .c source of all #ifdefs,
please just leave this as is.
Ok, and sorry for the noise.
Thanks,
Feng
Thanks,
Hugh