From: Pekka Enberg <penberg@kernel.org>
To: Oskar Andero <oskar.andero@sonymobile.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Radovan Lekanovic <radovan.lekanovic@sonymobile.com>,
David Rientjes <rientjes@google.com>,
Glauber Costa <glommer@openvz.org>,
Dave Chinner <dchinner@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v2] mm: vmscan: add VM_BUG_ON on illegal return values from scan_objects
Date: Tue, 21 May 2013 10:17:15 +0300 [thread overview]
Message-ID: <CAOJsxLGivq0p1j4Axykdz-O8FtYfn=M1BfLEnc=q-fjxA2Yonw@mail.gmail.com> (raw)
In-Reply-To: <1369120410-18180-1-git-send-email-oskar.andero@sonymobile.com>
On Tue, May 21, 2013 at 10:13 AM, Oskar Andero
<oskar.andero@sonymobile.com> wrote:
> Add a VM_BUG_ON to catch any illegal value from the shrinkers. It's a
> potential bug if scan_objects returns a negative other than -1 and
> would lead to undefined behaviour.
>
> Cc: Glauber Costa <glommer@openvz.org>
> Cc: Dave Chinner <dchinner@redhat.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Oskar Andero <oskar.andero@sonymobile.com>
> ---
> mm/vmscan.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 6bac41e..63fec86 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -293,6 +293,7 @@ shrink_slab_one(struct shrinker *shrinker, struct shrink_control *shrinkctl,
> ret = shrinker->scan_objects(shrinker, shrinkctl);
> if (ret == -1)
> break;
> + VM_BUG_ON(ret < -1);
It seems to me relaxing the shrinker API restrictions and changing the
"ret == -1" to "ret < 0" would be a much more robust approach...
> freed += ret;
>
> count_vm_events(SLABS_SCANNED, nr_to_scan);
> --
> 1.8.1.5
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-05-21 7:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 7:13 Oskar Andero
2013-05-21 7:17 ` Pekka Enberg [this message]
2013-05-21 7:28 ` Glauber Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOJsxLGivq0p1j4Axykdz-O8FtYfn=M1BfLEnc=q-fjxA2Yonw@mail.gmail.com' \
--to=penberg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dchinner@redhat.com \
--cc=glommer@openvz.org \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oskar.andero@sonymobile.com \
--cc=radovan.lekanovic@sonymobile.com \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox