public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ed Cashin <ecashin@coraid.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] aoe: adjust ref of head for compound page tails
Date: Wed, 7 Aug 2013 17:05:48 -0700	[thread overview]
Message-ID: <20130807170548.b4bb3355d3aec8f280c7feff@linux-foundation.org> (raw)
In-Reply-To: <FA421A63-C90D-42A2-B5A3-0B55AB22673F@coraid.com>

On Wed, 7 Aug 2013 19:54:45 -0400 Ed Cashin <ecashin@coraid.com> wrote:

> > +bio_pageinc(struct bio *bio)
> > +{
> > +       struct bio_vec *bv;
> > +       struct page *page;
> > +       int i;
> > +
> > +       bio_for_each_segment(bv, bio, i) {
> > +               page = bv->bv_page;
> > +               /* Non-zero page count for non-head members of
> > +                * compound pages is no longer allowed by the kernel,
> > +                * but this has never been seen here.
> > +                */
> > +               if (unlikely(PageCompound(page)))
> > +                       if (compound_trans_head(page) != page) {
> > +                               pr_crit("page tail used for block I/O\n");
> > +                               BUG();
> > +                       }
> > 
> > But get_page/put_page against a tail page of a compound page should
> > Just Work.  The core MM will hunt down the head page and manipulate its
> > refcount.  
> > 
> > Perhaps the problem here is that AOE is diving under the covers and is
> > using low-level page refcount alterations:
> > 
> > +               atomic_inc(&page->_count);
> > 
> > Why does AOE do this?  It would be better if it were to use the
> > official published MM interfaces.  If those interfaces need
> > alteration/augmentation then we can do that.
> 
> The get_page cannot be used when the _count is 0 (which is exactly when we need to increment it), because it will VM_BUG_ON.
> 
> 	/*
> 	 * Getting a normal page or the head of a compound page
> 	 * requires to already have an elevated page->_count.
> 	 */
> 	VM_BUG_ON(atomic_read(&page->_count) <= 0);
> 

But we shouldn't get that far:

static inline void get_page(struct page *page)
{
	if (unlikely(PageTail(page)))
		if (likely(__get_page_tail(page)))
			return;
	/*
	 * Getting a normal page or the head of a compound page
	 * requires to already have an elevated page->_count.
	 */
	VM_BUG_ON(atomic_read(&page->_count) <= 0);
	atomic_inc(&page->_count);
}

This is a tail page, so we should be using __get_page_tail().

  reply	other threads:[~2013-08-08  0:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02  1:29 [PATCH] aoe: respect compound page reference tracking expectations Ed Cashin
2013-08-02  1:29 ` [PATCH] aoe: adjust ref of head for compound page tails Ed Cashin
2013-08-07 20:58   ` Andrew Morton
2013-08-07 21:12     ` Ed Cashin
2013-08-07 21:18       ` Andrew Morton
2013-08-07 21:27         ` Andrew Morton
2013-08-07 23:41           ` Ed Cashin
2013-08-07 23:48             ` Ed Cashin
2013-08-07 23:51             ` Andrew Morton
2013-08-07 21:00   ` Andrew Morton
2013-08-07 21:21     ` Ed Cashin
2013-08-07 21:26       ` Andrew Morton
2013-08-07 23:27         ` Ed Cashin
2013-08-07 23:35           ` Andrew Morton
2013-08-07 23:54             ` Ed Cashin
2013-08-08  0:05               ` Andrew Morton [this message]
2013-08-08  0:50                 ` Ed Cashin
2013-08-08 19:56                   ` Andrew Morton
2013-08-08 21:02                     ` Ed Cashin

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=20130807170548.b4bb3355d3aec8f280c7feff@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ecashin@coraid.com \
    --cc=linux-kernel@vger.kernel.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