All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: David Hildenbrand <david@redhat.com>,
	linux-mm@kvack.org, Mike Kravetz <mike.kravetz@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	David Rientjes <rientjes@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Mel Gorman <mgorman@techsingularity.net>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Pavel Tatashin <pavel.tatashin@microsoft.com>,
	Matthew Wilcox <willy@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] mm/page_alloc: Add alloc_contig_pages()
Date: Thu, 17 Oct 2019 09:11:29 +0200	[thread overview]
Message-ID: <20191017071129.GB24485@dhcp22.suse.cz> (raw)
In-Reply-To: <c60b9e95-5c6c-fcb2-c8bb-13e7646ba8ea@arm.com>

On Thu 17-10-19 10:44:41, Anshuman Khandual wrote:
[...]
> Does this add-on documentation look okay ? Should we also mention about the
> possible reduction in chances of success during pfn block search for the
> non-power-of-two cases as the implicit alignment will probably turn out to
> be bigger than nr_pages itself ?
> 
>  * Requested nr_pages may or may not be power of two. The search for suitable
>  * memory range in a zone happens in nr_pages aligned pfn blocks. But in case
>  * when nr_pages is not power of two, an implicitly aligned pfn block search
>  * will happen which in turn will impact allocated memory block's alignment.
>  * In these cases, the size (i.e nr_pages) and the alignment of the allocated
>  * memory will be different. This problem does not exist when nr_pages is power
>  * of two where the size and the alignment of the allocated memory will always
>  * be nr_pages.

I dunno, it sounds more complicated than really necessary IMHO. Callers
shouldn't really be bothered by memory blocks and other really deep
implementation details.. Wouldn't be the below sufficient?

The allocated memory is always aligned to a page boundary. If nr_pages
is a power of two then the alignement is guaranteed to be to the given
nr_pages (e.g. 1GB request would be aligned to 1GB).
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2019-10-17  7:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 11:02 [PATCH V2] mm/page_alloc: Add alloc_contig_pages() Anshuman Khandual
2019-10-16 11:09 ` David Hildenbrand
2019-10-16 11:13   ` Anshuman Khandual
2019-10-16 11:51     ` Michal Hocko
2019-10-16 12:29       ` David Hildenbrand
2019-10-16 12:41         ` Michal Hocko
2019-10-16 15:31           ` Anshuman Khandual
2019-10-16 15:45             ` Michal Hocko
2019-10-16 16:48             ` David Hildenbrand
2019-10-17  5:14               ` Anshuman Khandual
2019-10-17  7:11                 ` Michal Hocko [this message]
2019-10-17  7:21                   ` David Hildenbrand
2019-10-17  7:34                     ` Michal Hocko
2019-10-17  7:38                       ` David Hildenbrand
2019-10-17  0:50 ` Mike Kravetz
2019-10-17  3:19   ` Anshuman Khandual

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=20191017071129.GB24485@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mike.kravetz@oracle.com \
    --cc=osalvador@suse.de \
    --cc=pavel.tatashin@microsoft.com \
    --cc=rientjes@google.com \
    --cc=rppt@linux.ibm.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.