Re: [PATCH] Dead code removal in madvise_willneed

From: Andrew Morton
Date: Wed Apr 16 2014 - 16:51:00 EST


On Wed, 16 Apr 2014 13:16:18 +0530 Yogesh Gaur <yogeshgaur.83@xxxxxxxxx> wrote:

> Dead code removal in func madvise_willneed().
> When file is NULL i.e. !file true
> case CONFIG_SWAP returns 0.
> else returns -EBADF.
> Signed-off-by: Yogesh Gaur <yogeshgaur.83@xxxxxxxxx>
> ---
> mm/madvise.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 7055883..be24987 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -231,10 +231,10 @@ static long madvise_willneed(struct vm_area_struct * vma,
> file->f_mapping);
> return 0;
> }
> -#endif
> -
> +#else
> if (!file)
> return -EBADF;
> +#endif

The compiler should have no trouble making this optimisation for us. I
don't see that it is necessary to add more ugly-looking ifdefs for
this.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/