linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: ira.weiny@intel.com, Jarkko Sakkinen <jarkko@kernel.org>
Cc: Sean Christopherson <seanjc@google.com>,
	Jethro Beekman <jethro@fortanix.com>,
	linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org
Subject: Re: [PATCH] x86: Remove unnecessary kmap() from sgx_ioc_enclave_init()
Date: Tue, 2 Feb 2021 10:55:36 -0800	[thread overview]
Message-ID: <ba4adad5-754f-65b5-5dae-69dee6803a23@intel.com> (raw)
In-Reply-To: <20210202013725.3514671-1-ira.weiny@intel.com>

On 2/1/21 5:37 PM, ira.weiny@intel.com wrote:
> kmap is inefficient and we are trying to reduce the usage in the kernel.
> There is no readily apparent reason why the initp_page page needs to be
> allocated and kmap'ed() but sigstruct needs to be page aligned and token
> 512 byte aligned.

Hi Ira,

It's a *relatively* recent guaranteed, but:

https://www.kernel.org/doc/Documentation/core-api/memory-allocation.rst

says:

> The address of a chunk allocated with `kmalloc` is aligned to at least
> ARCH_KMALLOC_MINALIGN bytes.  For sizes which are a power of two, the
> alignment is also guaranteed to be at least the respective size.

So, if you allocate a page with kmalloc(), you get an aligned page.  Yay!

  reply	other threads:[~2021-02-02 18:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  1:37 ira.weiny
2021-02-02 18:55 ` Dave Hansen [this message]
2021-02-02 22:43   ` Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2021-01-29  0:14 ira.weiny
2021-01-29 17:37 ` Sean Christopherson
2021-02-01  8:48   ` Christoph Hellwig
2021-02-02 17:37     ` Jarkko Sakkinen

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=ba4adad5-754f-65b5-5dae-69dee6803a23@intel.com \
    --to=dave.hansen@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jarkko@kernel.org \
    --cc=jethro@fortanix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=seanjc@google.com \
    --subject='Re: [PATCH] x86: Remove unnecessary kmap() from sgx_ioc_enclave_init()' \
    /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

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).