From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
"Todd Kjos" <tkjos@android.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Martijn Coenen" <maco@android.com>,
surenb@google.com, "Christian Brauner" <christian@brauner.io>
Subject: Re: [RFC] ashmem: Fix ashmem shrinker nr_to_scan
Date: Tue, 10 Mar 2020 13:46:01 +0300 [thread overview]
Message-ID: <20200310104601.GB11561@kadam> (raw)
In-Reply-To: <20200306011930.99378-1-joel@joelfernandes.org>
On Thu, Mar 05, 2020 at 08:19:30PM -0500, Joel Fernandes (Google) wrote:
> nr_to_scan is the number of pages to be freed however ashmem doesn't
> discount nr_to_scan correctly as it frees ranges. It should be
> discounting them by pages than by ranges. Correct the issue.
>
> Cc: surenb@google.com
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
> drivers/staging/android/ashmem.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 5891d0744a760..cb525ea6db98a 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -458,6 +458,8 @@ ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
> lru_del(range);
>
> freed += range_size(range);
> + sc->nr_to_scan -= range_size(range);
^^
Two space characters.
In the old code we didn't *really* have to worry about sc->nr_to_scan
dropping to negative, but now we do. ->nr_to_scan is unsigned so it
would be a high positive value now so it's maybe a forever loop? I'm
too lazy to verify...
regards,
dan carpenter
prev parent reply other threads:[~2020-03-10 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-06 1:19 Joel Fernandes (Google)
2020-03-10 10:46 ` Dan Carpenter [this message]
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=20200310104601.GB11561@kadam \
--to=dan.carpenter@oracle.com \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=surenb@google.com \
--cc=tkjos@android.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
all inboxes | Powered by JetHome®