linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Dave Jones <davej@redhat.com>, Andrew Morton <akpm@osdl.org>,
	Doug Gilbert <dougg@torqe.net>,
	James Bottomley <James.Bottomley@steeleye.com>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.15-mm2
Date: Mon, 9 Jan 2006 19:16:17 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0601091857430.15219@goblin.wat.veritas.com> (raw)
In-Reply-To: <9a8748490601091048x46716e25u2fe2ebe9b5fbc9bb@mail.gmail.com>

On Mon, 9 Jan 2006, Jesper Juhl wrote:
> Ok, with that patch the page, flags, mapping, mapcount & count
> information prints again.

Good, thanks.

> I get the exact same backtrace as before though, but a slightly
> different hexdump :

(I find -mm's hexdump addition really irritating.  Perhaps it could
be helpful if properly formatted, but not that dump of bytes.)

> Bad page state in process 'kded'
> page:c1e75400 flags:0x00000000 mapping:00000000 mapcount:1 count:0
> Trying to fix it up, but a reboot is needed
> Backtrace:
> [<c0103e77>] dump_stack+0x17/0x20
> [<c0148999>] bad_page+0x69/0x160
> [<c0148e92>] __free_pages_ok+0xa2/0x120
> [<c0149c7f>] __free_pages+0x2f/0x60
> [<c02acb63>] sg_page_free+0x23/0x30
> [<c02abdb3>] sg_remove_scat+0x63/0xe0
....

Having sent you the patch to restore the KERN_EMERGs, I then took a
look at drivers/scsi/sg.c, and it looks as if changes have gone into
2.6.15-git which might make more urgent a fix we knew would be needed
in some cases.  Could you try the patch below and let us know if it
fixes your problems?  Thanks...


Remove sg_rb_correct4mmap() and its nasty __put_page()s, which are liable
to do quite the wrong thing.  Instead allocate pages with __GFP_COMP, then
high-orders should be safe for exposure to userspace by sg_vma_nopage(),
without any further manipulations.  Based on original patch by Nick Piggin.

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

--- 2.6.15-mm2/drivers/scsi/sg.c	2006-01-09 11:36:26.000000000 +0000
+++ linux/drivers/scsi/sg.c	2006-01-09 18:46:17.000000000 +0000
@@ -1140,32 +1140,6 @@ sg_fasync(int fd, struct file *filp, int
 	return (retval < 0) ? retval : 0;
 }
 
-/* When startFinish==1 increments page counts for pages other than the 
-   first of scatter gather elements obtained from alloc_pages().
-   When startFinish==0 decrements ... */
-static void
-sg_rb_correct4mmap(Sg_scatter_hold * rsv_schp, int startFinish)
-{
-	struct scatterlist *sg = rsv_schp->buffer;
-	struct page *page;
-	int k, m;
-
-	SCSI_LOG_TIMEOUT(3, printk("sg_rb_correct4mmap: startFinish=%d, scatg=%d\n", 
-				   startFinish, rsv_schp->k_use_sg));
-	/* N.B. correction _not_ applied to base page of each allocation */
-	for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) {
-		for (m = PAGE_SIZE; m < sg->length; m += PAGE_SIZE) {
-			page = sg->page;
-			if (startFinish)
-				get_page(page);
-			else {
-				if (page_count(page) > 0)
-					__put_page(page);
-			}
-		}
-	}
-}
-
 static struct page *
 sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type)
 {
@@ -1237,10 +1211,7 @@ sg_mmap(struct file *filp, struct vm_are
 		sa += len;
 	}
 
-	if (0 == sfp->mmap_called) {
-		sg_rb_correct4mmap(rsv_schp, 1);	/* do only once per fd lifetime */
-		sfp->mmap_called = 1;
-	}
+	sfp->mmap_called = 1;
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_private_data = sfp;
 	vma->vm_ops = &sg_mmap_vm_ops;
@@ -2395,8 +2366,6 @@ __sg_remove_sfp(Sg_device * sdp, Sg_fd *
 		SCSI_LOG_TIMEOUT(6, 
 			printk("__sg_remove_sfp:    bufflen=%d, k_use_sg=%d\n",
 			(int) sfp->reserve.bufflen, (int) sfp->reserve.k_use_sg));
-		if (sfp->mmap_called)
-			sg_rb_correct4mmap(&sfp->reserve, 0);	/* undo correction */
 		sg_remove_scat(&sfp->reserve);
 	}
 	sfp->parentdp = NULL;
@@ -2478,9 +2447,9 @@ sg_page_malloc(int rqSz, int lowDma, int
 		return resp;
 
 	if (lowDma)
-		page_mask = GFP_ATOMIC | GFP_DMA | __GFP_NOWARN;
+		page_mask = GFP_ATOMIC | GFP_DMA | __GFP_NOWARN | __GFP_COMP;
 	else
-		page_mask = GFP_ATOMIC | __GFP_NOWARN;
+		page_mask = GFP_ATOMIC | __GFP_NOWARN | __GFP_COMP;
 
 	for (order = 0, a_size = PAGE_SIZE; a_size < rqSz;
 	     order++, a_size <<= 1) ;

  reply	other threads:[~2006-01-09 19:16 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-07 13:22 2.6.15-mm2 Andrew Morton
2006-01-07 13:23 ` 2.6.15-mm2 Andrew Morton
2006-01-07 15:05 ` 2.6.15-mm2 Reuben Farrelly
2006-01-07 21:31   ` 2.6.15-mm2 Andrew Morton
2006-01-07 22:06     ` 2.6.15-mm2 Reuben Farrelly
2006-01-07 23:15       ` 2.6.15-mm2 Reuben Farrelly
2006-01-07 23:40         ` 2.6.15-mm2 Andrew Morton
2006-01-10 10:15     ` 2.6.15-mm2 Reuben Farrelly
2006-01-10 10:30       ` 2.6.15-mm2 Andrew Morton
2006-01-10 10:58         ` 2.6.15-mm2 Reuben Farrelly
2006-01-10 10:47       ` 2.6.15-mm2 Ingo Molnar
2006-01-10 10:52         ` 2.6.15-mm2 Ingo Molnar
2006-01-10 10:58           ` 2.6.15-mm2 Ingo Molnar
2006-01-10 11:34           ` 2.6.15-mm2 Ingo Molnar
2006-01-10 12:28         ` 2.6.15-mm2 Reuben Farrelly
2006-01-10 12:42           ` 2.6.15-mm2 Andrew Morton
2006-01-10 13:16             ` 2.6.15-mm2 Ingo Molnar
2006-01-11  4:16               ` 2.6.15-mm2 Neil Brown
2006-01-11  5:15                 ` 2.6.15-mm2 Reuben Farrelly
2006-01-11  5:30                   ` 2.6.15-mm2 Andrew Morton
2006-01-11  5:30                     ` 2.6.15-mm2 Andrew Morton
2006-01-11 10:49                       ` 2.6.15-mm2 Reuben Farrelly
2006-01-11 11:05                         ` 2.6.15-mm2 Andrew Morton
2006-01-11 11:13                           ` 2.6.15-mm2 Jens Axboe
2006-01-11 11:40                             ` 2.6.15-mm2 Reuben Farrelly
2006-01-11 11:56                               ` 2.6.15-mm2 Jens Axboe
2006-01-11 14:39                                 ` 2.6.15-mm2 Reuben Farrelly
2006-01-11 14:52                                   ` 2.6.15-mm2 Jens Axboe
2006-01-11 14:55                                     ` 2.6.15-mm2 Jens Axboe
2006-01-11 19:23                                       ` 2.6.15-mm2 Reuben Farrelly
2006-01-11 19:45                                         ` 2.6.15-mm2 Jens Axboe
2006-01-11 19:53                                           ` 2.6.15-mm2 Jens Axboe
2006-01-12  3:49                                             ` 2.6.15-mm2 Reuben Farrelly
2006-01-12  8:00                                               ` 2.6.15-mm2 Tejun Heo
2006-01-12  8:22                                                 ` 2.6.15-mm2 Jens Axboe
     [not found]                                                 ` <43C61598.7050004@reub.net>
2006-01-12 11:18                                                   ` 2.6.15-mm2 Tejun Heo
2006-01-12 12:05                                                     ` 2.6.15-mm2 Reuben Farrelly
2006-01-12 12:31                                                       ` 2.6.15-mm2 Ric Wheeler
2006-01-12 12:39                                                         ` 2.6.15-mm2 Reuben Farrelly
2006-01-12 13:55                                                           ` 2.6.15-mm2 Tejun Heo
2006-01-12 14:10                                                             ` 2.6.15-mm2 Jens Axboe
2006-01-12 14:20                                                               ` 2.6.15-mm2 Tejun Heo
2006-01-12 19:26                                                             ` 2.6.15-mm2 Reuben Farrelly
2006-01-12 20:32                                                               ` 2.6.15-mm2 Andrew Morton
2006-01-12 20:51                                                                 ` 2.6.15-mm2 Jeff Garzik
2006-01-13  4:49                                                                   ` 2.6.15-mm2 Reuben Farrelly
2006-01-11 21:44                                 ` 2.6.15-mm2 Neil Brown
2006-01-12  7:35                                   ` 2.6.15-mm2 Jens Axboe
2006-01-07 15:08 ` 2.6.15-mm2 Jesper Juhl
2006-01-09 17:47   ` 2.6.15-mm2 Jesper Juhl
2006-01-09 17:57     ` 2.6.15-mm2 Dave Jones
2006-01-09 18:01       ` 2.6.15-mm2 Jesper Juhl
2006-01-09 18:24         ` 2.6.15-mm2 Hugh Dickins
2006-01-09 18:48           ` 2.6.15-mm2 Jesper Juhl
2006-01-09 19:16             ` Hugh Dickins [this message]
2006-01-09 19:21               ` 2.6.15-mm2 Hugh Dickins
2006-01-09 19:39               ` 2.6.15-mm2 Jesper Juhl
2006-01-09 20:15                 ` 2.6.15-mm Hugh Dickins
2006-01-09 20:30                   ` 2.6.15-mm Jesper Juhl
2006-01-09 20:41                     ` 2.6.15-mm Hugh Dickins
2006-01-09 20:46                       ` [PATCH] fix Jesper's sg_page_free Bad page states Hugh Dickins
2006-01-09 20:44                   ` 2.6.15-mm Mike Christie
2006-01-09 21:04                     ` 2.6.15-mm Hugh Dickins
2006-01-07 16:20 ` 2.6.15-mm2: why is __get_page_state() global again? Adrian Bunk
2006-01-07 18:00 ` [-mm patch] drivers/block/amiflop.c: fix compilation Adrian Bunk
2006-01-07 18:19 ` [-mm patch] drivers/acpi/: make two functions static Adrian Bunk
2006-01-07 18:21 ` [-mm patch] kernel/synchro-test.c: make 5 " Adrian Bunk
2006-01-07 19:31 ` 2.6.15-mm2 Brice Goglin
2006-01-07 21:04   ` 2.6.15-mm2 Dave Jones
2006-01-07 21:26     ` 2.6.15-mm2 Brice Goglin
2006-01-07 21:29       ` 2.6.15-mm2 David S. Miller
2006-01-07 21:41       ` 2.6.15-mm2 Arjan van de Ven
2006-01-07 21:42       ` 2.6.15-mm2 Dave Jones
2006-01-07 21:50         ` 2.6.15-mm2 Brice Goglin
2006-01-07 22:13           ` 2.6.15-mm2 Dave Jones
2006-01-07 22:26             ` 2.6.15-mm2 Brice Goglin
2006-01-11 18:41       ` 2.6.15-mm2 Brice Goglin
2006-01-11 20:29         ` 2.6.15-mm2 Dave Jones
2006-01-11 21:50           ` 2.6.15-mm2 Dave Airlie
2006-01-11 21:56             ` 2.6.15-mm2 Dave Jones
2006-01-11 23:50               ` 2.6.15-mm2 Dave Airlie
2006-01-12 10:58           ` 2.6.15-mm2 Ulrich Mueller
2006-01-12 17:11             ` 2.6.15-mm2 Dave Jones
2006-01-12 18:11               ` 2.6.15-mm2 Ulrich Mueller
2006-01-12 20:37                 ` 2.6.15-mm2 Dave Airlie
2006-01-12 21:03                   ` 2.6.15-mm2 Alan Hourihane
2006-01-12 22:02                     ` 2.6.15-mm2 Dave Airlie
2006-01-13  8:32                       ` 2.6.15-mm2 Alan Hourihane
2006-01-13 16:49                         ` 2.6.15-mm2 Dave Jones
2006-01-12 19:12               ` 2.6.15-mm2 Brice Goglin
2006-01-12 19:21                 ` 2.6.15-mm2 Dave Jones
2006-01-07 22:58   ` 2.6.15-mm2 Andrew Morton
2006-01-07 23:38     ` 2.6.15-mm2 Brice Goglin
2006-01-08 12:24       ` 2.6.15-mm2 Andrew Morton
2006-01-08 14:39         ` 2.6.15-mm2 Brice Goglin
2006-01-08 18:56           ` 2.6.15-mm2 Andrew Morton
2006-01-08 12:28       ` 2.6.15-mm2 Andrew Morton
2006-01-08 14:14         ` 2.6.15-mm2 Brice Goglin
2006-01-07 20:51 ` Badness in __mutex_unlock_slowpath Andrew James Wade
2006-01-07 21:13   ` Arjan van de Ven
2006-01-08  8:53     ` Ingo Molnar
2006-01-07 21:06 ` 2.6.15-mm2: alpha broken Alexey Dobriyan
2006-01-07 23:48   ` Andrew Morton
2006-01-08  0:45     ` [PATCH -mm] fixup *at syscalls additions (alpha, sparc64) Alexey Dobriyan
2006-01-08  0:54     ` [PATCH -mm] Fixup arch/alpha/mm/init.c compilation Alexey Dobriyan
2006-01-08 12:31     ` 2.6.15-mm2: alpha broken Alexey Dobriyan
2006-01-11  2:24     ` Paul Jackson
2006-01-13 14:11       ` Adrian Bunk
2006-01-13 15:52         ` Paul Jackson
2006-01-13 16:37         ` Al Viro
2006-01-13 18:10         ` Paul Jackson
2006-01-13 18:19           ` Randy.Dunlap
2006-01-13 19:05             ` Thomas Gleixner
2006-01-13 21:08             ` Adrian Bunk
2006-01-13 21:12               ` Randy.Dunlap
2006-01-13 21:32                 ` Adrian Bunk
2006-01-13 21:52                   ` Paul Jackson
2006-01-13 22:18                     ` Andrew Morton
2006-01-13 19:26           ` Andrew Morton
2006-01-13 21:05           ` Adrian Bunk
2006-01-08  0:40 ` 2.6.15-mm2 Alexander Gran
     [not found] ` <200601080139.34774@zodiac.zodiac.dnsalias.org>
     [not found]   ` <20060107175056.3d7a2895.akpm@osdl.org>
2006-01-10  0:30     ` 2.6.15-mm2 Alexander Gran
2006-01-10  1:22       ` 2.6.15-mm2 Andrew Morton
2006-01-10 21:20 ` 2.6.15-mm2 Serge E. Hallyn
2006-01-07 21:51 2.6.15-mm2 Chuck Ebbert
2006-01-07 22:01 2.6.15-mm2 Chuck Ebbert
2006-01-08  8:16 2.6.15-mm2 Brown, Len
2006-01-08 14:23 ` 2.6.15-mm2 Brice Goglin
2006-01-08  8:19 2.6.15-mm2 Brown, Len
2006-01-08  9:40 ` 2.6.15-mm2 Reuben Farrelly
2006-01-08 17:58 2.6.15-mm2 Brown, Len
2006-01-08 18:08 2.6.15-mm2 Brown, Len
2006-01-08 18:18 2.6.15-mm2 Brown, Len

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.0601091857430.15219@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=davej@redhat.com \
    --cc=dougg@torqe.net \
    --cc=jesper.juhl@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).