public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Nick Piggin <npiggin@suse.de>,
	torvalds@osdl.org, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org, dougg@torque.net
Subject: Re: [patch] sg: simplify page_count manipulations
Date: Fri, 20 Jan 2006 16:32:00 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0601201623480.6415@goblin.wat.veritas.com> (raw)
In-Reply-To: <20060120024702.6f894a13.akpm@osdl.org>

On Fri, 20 Jan 2006, Andrew Morton wrote:
> Nick Piggin <npiggin@suse.de> wrote:
> > On Thu, Jan 19, 2006 at 02:05:25PM -0800, Andrew Morton wrote:
> > > Nick Piggin <npiggin@suse.de> wrote:
> > > >
> > > > On Wed, Jan 18, 2006 at 07:59:37PM -0800, Andrew Morton wrote:
> > > > > Nick Piggin <npiggin@suse.de> wrote:
> > > > > > -	/* 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);
> > > > > > -			}
> > > > > > -		}
> > > > > > -	}
> > > > > > -}
> > > > > 
> > > > > What on earth is the above trying to do?  The inner loop is a rather
> > > > > complex way of doing atomic_add(&page->count, sg->length/PAGE_SIZE).  One
> > > > > suspects there's a missing "[m]" in there.
> > > > > 
> > > > 
> > > > It does this on the first mmap of the device, in the hope that subsequent
> > > > nopage, unmaps would not free the constituent pages in the scatterlist.
> > > > 
> > > 
> > > But it's doing it wrongly, isn't it?  Or am I completely nuts?
> > 
> > No I think you're right. I'm not sure why this doesn't oops but I
> > thought it was the (main) reason others wanted to get rid of this
> > convoluted code earlier on. I see nobody else is planning to do anything
> > about it though, so I figure I must have missed the reason why it isn't
> > a problem.
> > 
> > But either way I don't think the code actually _does_ anything, even if
> > its bugginess doesn't actually lead to a bug.
> > 
> 
> I suspect nobody tried to munmap pages beyond the first one.
> 
> Yes, let's use a compound page in there and I expect Doug will be able to
> test it for us sometime.

That function did move page along in 2.6.15, but has got screwed up since:
good reason, I think, to speed Nick's patch through to clean it all away.

Hugh

  reply	other threads:[~2006-01-20 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060118155242.GB28418@wotan.suse.de>
2006-01-19  3:59 ` [patch] sg: simplify page_count manipulations Andrew Morton
2006-01-19 14:45   ` Nick Piggin
2006-01-19 22:05     ` Andrew Morton
2006-01-20 10:18       ` Nick Piggin
2006-01-20 10:47         ` Andrew Morton
2006-01-20 16:32           ` Hugh Dickins [this message]
2006-01-21 10:15             ` Nick Piggin

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.0601201623480.6415@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=akpm@osdl.org \
    --cc=dougg@torque.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=torvalds@osdl.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