From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C7C8C433DB for ; Mon, 8 Mar 2021 23:15:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 77DBF6528A for ; Mon, 8 Mar 2021 23:15:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77DBF6528A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CCF048D0085; Mon, 8 Mar 2021 18:15:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7EF98D007F; Mon, 8 Mar 2021 18:15:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B467D8D0085; Mon, 8 Mar 2021 18:15:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 9B96F8D007F for ; Mon, 8 Mar 2021 18:15:13 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 49339181AEF15 for ; Mon, 8 Mar 2021 23:15:13 +0000 (UTC) X-FDA: 77898264906.08.8AEBFA5 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP id 308632000382 for ; Mon, 8 Mar 2021 23:15:13 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 10C42651CF; Mon, 8 Mar 2021 23:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1615245310; bh=sV63V3vuQtvSRN8I9yPcerrTYlYsHA9SrU7VkclIbyQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Qh8yNuH1oclHT56gN6AZEJkBXhWK/RhDUTPoyB1TvEnMTNnVgjKuKXS7SAtPI7Rrv cUUDjeMwkbDkCskzoPBGIIuxwe6mHcLzSMtLuYf/g7hoY857r6ELrYhPgC+SyICMxy E88/6tFnbHexqul+lfrQRKdad9TgPEuytqkbG/P8= Date: Mon, 8 Mar 2021 15:15:09 -0800 From: Andrew Morton To: Matthew Wilcox Cc: jianhong chen , linux-mm@kvack.org, Michal Hocko , Vlastimil Babka , "Kirill A . Shutemov" , Yang Shi , Michel Lespinasse Subject: Re: mm/mmap.c: fix the adjusted length error Message-Id: <20210308151509.5b63c7e51a7f41f7fda697dc@linux-foundation.org> In-Reply-To: <20210308185002.GD3479805@casper.infradead.org> References: <20210308185002.GD3479805@casper.infradead.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: f1z5omhdekotdokws857nm638d67mcqt X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 308632000382 Received-SPF: none (linux-foundation.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615245313-564668 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 8 Mar 2021 18:50:02 +0000 Matthew Wilcox wrote: > 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. OK, thanks. The patch is very old, and stuck. I'll drop it.