mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
	David Vrabel <david.vrabel@citrix.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v2] x86: fix small LDT allocation for Xen
Date: Wed, 2 Sep 2015 18:59:22 +0200	[thread overview]
Message-ID: <20150902165922.GA5959@gmail.com> (raw)
In-Reply-To: <55E7347D020000780009F1DA@prv-mh.provo.novell.com>


* Jan Beulich <JBeulich@suse.com> wrote:

> >> @@ -95,7 +95,7 @@ static void free_ldt_struct(struct ldt_s
> >>         if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)
> >>                 vfree(ldt->entries);
> >>         else
> >> -               kfree(ldt->entries);
> >> +               put_page(virt_to_page(ldt->entries));
> > 
> > FWIW, I'm not convinced this is or was correct.  Using free_page looks
> > a bit safer, and free_page does more than just put_page.
> 
> Actually I agree. put_page() is meant to be paired with get_page();
> __get_free_pages() is just misleading (i.e. doesn't imply a get_page())
> and instead is to be paired with free_pages(). Will do a v3 then.

So put_page() is a page cache primitive and should not be used outside of it.

As it happens, it is safe to put_page() a regularly allocated page as well, but 
it's a little bit slower than doing a free_page().

Thanks,

	Ingo

      reply	other threads:[~2015-09-02 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 12:46 Jan Beulich
2015-09-02 14:08 ` Andy Lutomirski
2015-09-02 15:40   ` Jan Beulich
2015-09-02 16:59     ` Ingo Molnar [this message]

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=20150902165922.GA5959@gmail.com \
    --to=mingo@kernel.org \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome