linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: jianhong chen <chenjianhong2@huawei.com>,
	linux-mm@kvack.org, Michal Hocko <mhocko@suse.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Michel Lespinasse <walken@google.com>
Subject: mm/mmap.c: fix the adjusted length error
Date: Mon, 8 Mar 2021 18:50:02 +0000	[thread overview]
Message-ID: <20210308185002.GD3479805@casper.infradead.org> (raw)

Hi Andrew,

You have a patch in your tree which I think is a bad idea.
Link: http://lkml.kernel.org/r/1558073209-79549-1-git-send-email-chenjianhong2@huawei.com

The problem it describes is real -- if you chew up all the address
space with 64MB pages, free one and then try to allocate another one, it
will fail.  I don't like the solution, though.  If memory is fragmented
in a different way from that described by the patch, it will cause us
to walk into rbtree nodes that look like they might be able to satisfy
our allocation, only to find that they cannot, due to alignment issues.
In the worst case, it turns into a linear scan of the address space
instead of logarithmic.

I would prefer to see this solved by doing two passes.  The first would
look for a 128MB size hole, as we do now, which is guaranteed to find
us a 64MB hole if it succeeds.  If that search fails, then we can fall
back to the 64MB hole search, as done in this patch.



             reply	other threads:[~2021-03-08 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 18:50 Matthew Wilcox [this message]
2021-03-08 23:15 ` Andrew Morton

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=20210308185002.GD3479805@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=chenjianhong2@huawei.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=vbabka@suse.cz \
    --cc=walken@google.com \
    --cc=yang.shi@linux.alibaba.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