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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1747EC433FE for ; Wed, 20 Apr 2022 21:57:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F3756B0071; Wed, 20 Apr 2022 17:57:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A2516B0073; Wed, 20 Apr 2022 17:57:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46A806B0074; Wed, 20 Apr 2022 17:57:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 3558A6B0071 for ; Wed, 20 Apr 2022 17:57:46 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E2CDE26741 for ; Wed, 20 Apr 2022 21:57:45 +0000 (UTC) X-FDA: 79378620090.05.45FE495 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id AC1FA1C0013 for ; Wed, 20 Apr 2022 21:57:43 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5D065CE1FB1; Wed, 20 Apr 2022 21:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 665F3C385A0; Wed, 20 Apr 2022 21:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1650491860; bh=vmNtN9e9H1hSyHfV0BVf2/UBMQJeK+7vsMOQz3vywEM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QGuPO28joxCzaeenSatWUy6HeYYIZDwI2mgdBaQKHG1cES9xrTr1CYefq2EuB2xWr 8lRPDj+HJCpxZlLF1AO9J79kC+CcwvHHrjcusBjdk9JLoLh3yapcIU47NEjw3EOOIH 2Yw8VyfI8aaRT01Vp/Sx/fNLypSYGTT1MN0bGRns= Date: Wed, 20 Apr 2022 14:57:39 -0700 From: Andrew Morton To: lipeifeng@oppo.com Cc: peifeng55@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, 21cnbao@gmail.com, zhangshiming@oppo.com Subject: Re: [PATCH] mm: modify the method to search addr in unmapped_area Message-Id: <20220420145739.425c01603a6f63e550e556ed@linux-foundation.org> In-Reply-To: <20220420084039.1431-1-lipeifeng@oppo.com> References: <20220420084039.1431-1-lipeifeng@oppo.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=QGuPO28j; spf=pass (imf18.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: 36yr5wj9xo57q3mqp3ciddx1x3o4f11j X-Rspamd-Queue-Id: AC1FA1C0013 X-Rspamd-Server: rspam04 X-Rspam-User: X-HE-Tag: 1650491863-655510 X-Bogosity: Ham, tests=bogofilter, spamicity=0.022482, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 20 Apr 2022 16:40:39 +0800 lipeifeng@oppo.com wrote: > The old method will firstly find the space in len(info->length > + info->align_mask), and get address at the desired alignment. > > Sometime, addr would be failed if there are enough > addr space in kernel by above method, e.g., you can't get a > addr sized in 1Mbytes, align_mask 1Mbytes successfully although > there are still (2M-1)bytes space in kernel. > > This patch would fix thr problem above by the new method: find the > space in info->length and judge if at the desired info->align_mask > at the same time. > > Do a simple test in TIF_32BIT with unmapped_area: > - Try to take addr (size:1M align:2M) until allocation fails; > - Try to take addr (size:1M align:1M) and account how to space can > be alloced successfully. > > Before optimization: alloced 0 bytes. > After optimization: alloced 1.9+G bytes. Thanks. Unfortunately this part of the code is undergoing a lot of change lately. How serious is this problem? Please tell us how often the problem is being observed, under what circumstances, etc.