linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
	akpm@linux-foundation.org, ard.biesheuvel@linaro.org,
	broonie@kernel.org, christophe.leroy@c-s.fr,
	dan.j.williams@intel.com, dave.hansen@intel.com,
	davem@davemloft.net, gerald.schaefer@de.ibm.com,
	gregkh@linuxfoundation.org, heiko.carstens@de.ibm.com,
	jgg@ziepe.ca, jhogan@kernel.org, keescook@chromium.org,
	kirill@shutemov.name, linux@armlinux.org.uk,
	mark.rutland@arm.com, mike.kravetz@oracle.com,
	mm-commits@vger.kernel.org, mpe@ellerman.id.au,
	paul.burton@mips.com, paulus@samba.org,
	penguin-kernel@i-love.sakura.ne.jp, peterz@infradead.org,
	ralf@linux-mips.org, rppt@linux.vnet.ibm.com,
	schowdary@nvidia.com, schwidefsky@de.ibm.com,
	Steven.Price@arm.com, tglx@linutronix.de, vbabka@suse.cz,
	vgupta@synopsys.com, yamada.masahiro@socionext.com,
	linux-mm@kvack.org
Subject: Re: + mm-hugetlb-make-alloc_gigantic_page-available-for-general-use.patch added to -mm tree
Date: Tue, 15 Oct 2019 13:36:06 +0200	[thread overview]
Message-ID: <20191015113606.GA317@dhcp22.suse.cz> (raw)
In-Reply-To: <20191015112433.GC32665@bombadil.infradead.org>

On Tue 15-10-19 04:24:33, Matthew Wilcox wrote:
> On Tue, Oct 15, 2019 at 03:00:49PM +0530, Anshuman Khandual wrote:
> > On 10/15/2019 01:59 AM, Matthew Wilcox wrote:
> > > On Mon, Oct 14, 2019 at 02:17:30PM +0200, Michal Hocko wrote:
> > >> On Fri 11-10-19 13:29:32, Andrew Morton wrote:
> > >>> alloc_gigantic_page() implements an allocation method where it scans over
> > >>> various zones looking for a large contiguous memory block which could not
> > >>> have been allocated through the buddy allocator.  A subsequent patch which
> > >>> tests arch page table helpers needs such a method to allocate PUD_SIZE
> > >>> sized memory block.  In the future such methods might have other use cases
> > >>> as well.  So alloc_gigantic_page() has been split carving out actual
> > >>> memory allocation method and made available via new
> > >>> alloc_gigantic_page_order().
> > >>
> > >> You are exporting a helper used for hugetlb internally. Is this really
> > >> what is needed? I haven't followed this patchset but don't you simply
> > >> need a generic 1GB allocator? If yes then you should be looking at
> > >> alloc_contig_range.
> > > 
> > > He actually doesn't need to allocate any memory at all.  All he needs is
> > > the address of a valid contiguous PUD-sized chunk of memory.
> > > 
> > 
> > We had already discussed about the benefits of allocated memory over
> > synthetic pfn potentially derived from a kernel text symbol. More
> > over we are not adding any new helper or new code for this purpose,
> > but instead just trying to reuse code which is already present.
> 
> Yes, and I'm pretty sure you're just wrong.  But I don't know that you're
> wrong for all architectures.  Re-reading that, I'm still not sure you
> understood what I was suggesting, so I'll say it again differently.
> 
> Look up a kernel symbol, something like kernel_init().  This will
> have a virtual address upon which it is safe to call virt_to_pfn().
> Let's presume it's in PFN 0x12345678.  Use 0x12345678 as the PFN for
> your PTE level tests.
> 
> Then clear the bottom (eg) 9 bits from it and use 0x1234400 for your PMD
> level tests.  Then clear the bottom 18 bits from it and use 0x12300000
> for your PUD level tests.
> 
> I don't think it matters whether there's physical memory at PFN 0x12300000
> or not.  The various p?d_* functions should work as long as the PFN is
> in some plausible range.
> 
> I gave up arguing because you seemed uninterested in this approach,
> but now that Michal is pointing out that your approach is all wrong,
> maybe you'll listen.

Just for the record. I didn't really get to read the patch 2 in this
series. Matthew is right that I disagree with the current state of the
"large pages" allocator. If my concerns get resolved then I do not mind
having it regardless of what patch 2 ends up doing and whether it uses
it or not.

On the other hand, having a testing code that really requires a lot of
memory to allocate to test page table walkers seems indeed a bit too
strong of an assumption. Especially when there are ways around that as
Matthew is suggesting so I would really listen to his suggestions.

-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2019-10-15 11:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191011202932.GZoUOoURm%akpm@linux-foundation.org>
2019-10-14 12:17 ` + mm-hugetlb-make-alloc_gigantic_page-available-for-general-use.patch added to -mm tree Michal Hocko
2019-10-14 12:53   ` Anshuman Khandual
2019-10-14 13:00     ` Michal Hocko
2019-10-14 13:08       ` Anshuman Khandual
2019-10-14 13:21         ` Michal Hocko
2019-10-14 16:52         ` Mike Kravetz
2019-10-15  9:57           ` Anshuman Khandual
2019-10-15 10:31             ` Michal Hocko
2019-10-15 10:34               ` Anshuman Khandual
2019-10-14 20:29   ` Matthew Wilcox
2019-10-15  9:30     ` Anshuman Khandual
2019-10-15 11:24       ` Matthew Wilcox
2019-10-15 11:36         ` Michal Hocko [this message]
2019-10-15 12:14           ` Anshuman Khandual
2019-10-16  8:55         ` 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=20191015113606.GA317@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=Steven.Price@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=broonie@kernel.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=davem@davemloft.net \
    --cc=gerald.schaefer@de.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jgg@ziepe.ca \
    --cc=jhogan@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mike.kravetz@oracle.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=paul.burton@mips.com \
    --cc=paulus@samba.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=schowdary@nvidia.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=vgupta@synopsys.com \
    --cc=willy@infradead.org \
    --cc=yamada.masahiro@socionext.com \
    /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;
as well as URLs for NNTP newsgroup(s).