mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>, linux-kernel@vger.kernel.org
Subject: [PATCH 09/11] unpaged: ZERO_PAGE in VM_UNPAGED
Date: Thu, 17 Nov 2005 19:38:40 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0511171938080.4563@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0511171925290.4563@goblin.wat.veritas.com>

It's strange enough to be looking out for anonymous pages in VM_UNPAGED
areas, let's not insert the ZERO_PAGE there - though whether it would
matter will depend on what we decide about ZERO_PAGE refcounting.

But whereas do_anonymous_page may (exceptionally) be called on a
VM_UNPAGED area, do_no_page should never be: just BUG_ON.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
---

 drivers/char/mem.c |    2 +-
 mm/memory.c        |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

--- unpaged08/drivers/char/mem.c	2005-11-12 09:00:39.000000000 +0000
+++ unpaged09/drivers/char/mem.c	2005-11-17 15:11:57.000000000 +0000
@@ -591,7 +591,7 @@ static inline size_t read_zero_pagealign
 
 		if (vma->vm_start > addr || (vma->vm_flags & VM_WRITE) == 0)
 			goto out_up;
-		if (vma->vm_flags & (VM_SHARED | VM_HUGETLB))
+		if (vma->vm_flags & (VM_SHARED | VM_HUGETLB | VM_UNPAGED))
 			break;
 		count = vma->vm_end - addr;
 		if (count > size)
--- unpaged08/mm/memory.c	2005-11-17 15:11:43.000000000 +0000
+++ unpaged09/mm/memory.c	2005-11-17 15:11:57.000000000 +0000
@@ -1812,7 +1812,16 @@ static int do_anonymous_page(struct mm_s
 	spinlock_t *ptl;
 	pte_t entry;
 
-	if (write_access) {
+	/*
+	 * A VM_UNPAGED vma will normally be filled with present ptes
+	 * by remap_pfn_range, and never arrive here; but it might have
+	 * holes, or if !VM_DONTEXPAND, mremap might have expanded it.
+	 * It's weird enough handling anon pages in unpaged vmas, we do
+	 * not want to worry about ZERO_PAGEs too (it may or may not
+	 * matter if their counts wrap): just give them anon pages.
+	 */
+
+	if (write_access || (vma->vm_flags & VM_UNPAGED)) {
 		/* Allocate our own private page. */
 		pte_unmap(page_table);
 
@@ -1887,6 +1896,7 @@ static int do_no_page(struct mm_struct *
 	int anon = 0;
 
 	pte_unmap(page_table);
+	BUG_ON(vma->vm_flags & VM_UNPAGED);
 
 	if (vma->vm_file) {
 		mapping = vma->vm_file->f_mapping;
@@ -1962,7 +1972,7 @@ retry:
 			inc_mm_counter(mm, anon_rss);
 			lru_cache_add_active(new_page);
 			page_add_anon_rmap(new_page, vma, address);
-		} else if (!(vma->vm_flags & VM_UNPAGED)) {
+		} else {
 			inc_mm_counter(mm, file_rss);
 			page_add_file_rmap(new_page);
 		}

  parent reply	other threads:[~2005-11-17 19:40 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 19:28 [PATCH 00/11] unpaged: PageReserved VM fixups Hugh Dickins
2005-11-17 19:29 ` [PATCH 01/11] unpaged: get_user_pages VM_RESERVED Hugh Dickins
2005-11-17 23:29   ` David S. Miller
2005-11-17 19:30 ` [PATCH 02/11] unpaged: private write VM_RESERVED Hugh Dickins
2005-11-17 19:41   ` Dave Jones
2005-11-17 20:46     ` Dominik Brodowski
2005-11-17 20:51       ` Dave Jones
2005-11-17 23:58         ` David S. Miller
2005-11-18  7:12           ` Dominik Brodowski
2005-11-18  7:59             ` David S. Miller
2005-11-17 20:59       ` Dominik Brodowski
2005-11-17 23:36   ` David S. Miller
2005-11-17 19:31 ` [PATCH 03/11] unpaged: sound nopage get_page Hugh Dickins
2005-11-17 23:41   ` David S. Miller
2005-11-17 19:32 ` [PATCH 04/11] unpaged: unifdefed PageCompound Hugh Dickins
2005-11-17 23:43   ` David S. Miller
2005-11-19 20:15     ` Hugh Dickins
2005-11-19 20:55       ` William Lee Irwin III
2005-11-19 21:41         ` David S. Miller
2005-11-19 21:58           ` William Lee Irwin III
2005-11-17 19:34 ` [PATCH 05/11] unpaged: VM_UNPAGED Hugh Dickins
2005-11-17 20:59   ` William Lee Irwin III
2005-11-17 23:46   ` David S. Miller
2005-11-17 19:36 ` [PATCH 06/11] unpaged: VM_NONLINEAR VM_RESERVED Hugh Dickins
2005-11-17 19:37 ` [PATCH 07/11] unpaged: COW on VM_UNPAGED Hugh Dickins
2005-11-17 23:52   ` David S. Miller
2005-11-18  5:46     ` Nick Piggin
2005-11-18  6:45       ` David S. Miller
2005-11-18  7:27         ` Hugh Dickins
2005-11-18  7:46           ` Andrew Morton
2005-11-18  8:04           ` David S. Miller
2005-11-18  8:12             ` Hugh Dickins
2005-11-18  8:02         ` Hugh Dickins
2005-11-18  8:08           ` David S. Miller
2005-11-18  8:13             ` Hugh Dickins
2005-11-18  8:36               ` David S. Miller
2005-11-18  9:33                 ` Hugh Dickins
2005-11-18 21:08           ` Dave Jones
2005-11-18 19:12     ` Alan Cox
2005-11-17 19:38 ` [PATCH 08/11] unpaged: anon in VM_UNPAGED Hugh Dickins
2005-11-17 19:38 ` Hugh Dickins [this message]
2005-11-17 21:25   ` [PATCH 09/11] unpaged: ZERO_PAGE " Ingo Oeser
2005-11-18 19:58     ` Hugh Dickins
2005-11-17 19:39 ` [PATCH 10/11] unpaged: PG_reserved bad_page Hugh Dickins
2005-11-17 19:40 ` [PATCH 11/11] unpaged: copy_page_range vma Hugh Dickins

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=Pine.LNX.4.61.0511171938080.4563@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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®