From: Hugh Dickins <hughd@google.com>
To: Hillf Danton <dhillf@gmail.com>
Cc: Linux-MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: shmem: unlock valid page
Date: Sun, 4 Mar 2012 09:51:01 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.00.1203040943240.18498@eggly.anvils> (raw)
In-Reply-To: <CAJd=RBBYdY1rgoW+0bgKh6Cn8n=guB2_zq2nzaMr8-arqNkr_A@mail.gmail.com>
On Sun, 4 Mar 2012, Hillf Danton wrote:
> In shmem_read_mapping_page_gfp() page is unlocked if no error returned,
> so the unlocked page has to valid.
>
> To guarantee that validity, when getting page, success result is feed
> back to caller only when page is valid.
>
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
I don't understand your description, nor its relation to the patch.
NAK to the patch: when no page has previously been allocated, the
SGP_READ case avoids allocation and returns NULL - do_shmem_file_read
then copies the ZERO_PAGE instead, avoiding lots of unnecessary memory
allocation when reading a large sparse file.
Hugh
> ---
>
> --- a/mm/shmem.c Sun Mar 4 12:17:42 2012
> +++ b/mm/shmem.c Sun Mar 4 12:26:56 2012
> @@ -889,13 +889,13 @@ repeat:
> goto failed;
> }
>
> - if (page || (sgp == SGP_READ && !swap.val)) {
> + if (page) {
> /*
> * Once we can get the page lock, it must be uptodate:
> * if there were an error in reading back from swap,
> * the page would not be inserted into the filecache.
> */
> - BUG_ON(page && !PageUptodate(page));
> + BUG_ON(!PageUptodate(page));
> *pagep = page;
> return 0;
> }
> --
>
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-03-04 17:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-04 5:17 Hillf Danton
2012-03-04 17:51 ` Hugh Dickins [this message]
2012-03-05 12:15 ` Hillf Danton
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=alpine.LSU.2.00.1203040943240.18498@eggly.anvils \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=dhillf@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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