mirror of https://lore.kernel.org/lkml/
 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: Thu, 8 Aug 2013 12:56:29 -0700	[thread overview]
Message-ID: <20130808125629.a5d6a55638743e2deee43065@linux-foundation.org> (raw)
In-Reply-To: <6E6337F8-28E9-4361-A7E5-063C6AFFE5BD@coraid.com>

On Wed, 7 Aug 2013 20:50:09 -0400 Ed Cashin <ecashin@coraid.com> wrote:

> > 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().
> 
> 
> When the workaround was created, it was with the assumption that the zero-count pages are not always tail pages, and that seemed to be the case in 2007, but as I said, I don't have a mechanism for detecting that now, so I cannot say whether it really happens with today's kernel.

It sounds we should pull out all that code and retest.  It shouldn't be
needed - if this results in some failure then I suspect core MM will
need changes.

Why don't you have a "mechanism for detecting that"?  It's a matter of
pointing AOE at some hugetlb pages?

> If it is never correct for normal pages or compound page heads to have a zero count while they are associated with a bio, then yes, I think get_page is a great solution.  The VM_BUG_ON in get_page would identify any parts of the kernel that are supplying bios that have pages without references.
> 
> Just a note in response to "we shouldn't get that far":  I believe the VM_BUG_ON line in get_page does get executed for tail pages when the __get_page_tail returns false because the compound page head has a zero count:
> 
>   get_page -> __get_page_tail -> get_page_unless_zero returns false, so
>     __get_page_tail returns "got", which is still false, so
>       get_page executes the VM_BUG_ON, where the _count will be zero for the tail page.

Yup.  If we hit a zero-ref huge page here then we want that BUG_ON to trigger.


  reply	other threads:[~2013-08-08 19:56 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
2013-08-08  0:50                 ` Ed Cashin
2013-08-08 19:56                   ` Andrew Morton [this message]
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=20130808125629.a5d6a55638743e2deee43065@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

all inboxes | Powered by JetHome®