From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 677FC6EC58; Mon, 2 Aug 2021 18:55:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 677FC6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627919723; bh=r9cjjVXFH7Fr0vq5Q94tjetbm5TWov2pYTB0/WJiLjY=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=x/Pi1Ay38vejcPVDhdbA7SpcDEJMnr0FNyCaV2MhwpcsgzHO9fPw1Dd+A/F7wpd8c agRu3+QJTRyBjtBu+FkgEqJwW46gA6DgxFoeTmY7qDBRASApMyKTKuyHPxrYrA6Oqq eImTbrtvebaYGK6sYHWQhW7Zlc0jDhz+fNy/08fM= Received: from smtp30.i.mail.ru (smtp30.i.mail.ru [94.100.177.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E1FDE6EC58 for ; Mon, 2 Aug 2021 18:55:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E1FDE6EC58 Received: by smtp30.i.mail.ru with esmtpa (envelope-from ) id 1mAaHh-0008DJ-0n; Mon, 02 Aug 2021 18:55:21 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) In-Reply-To: Date: Mon, 2 Aug 2021 18:55:19 +0300 Content-Transfer-Encoding: 7bit Message-Id: <50245C6B-737F-4C11-B091-FAFDCD32506E@tarantool.org> References: <20210727152323.GS27855@tarantool.org> <20210801103633.GX27855@tarantool.org> To: Sergey Kaplun X-Mailer: Apple Mail (2.3654.100.0.2.22) X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C351B198F4576AC7B20CA14D9DFB46B94A182A05F53808504091D5468233769D5EA74DC903BA25B49B18FE5C2909C2CB4064331DDBF9A0E664 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74AA616721CED6291EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637A521848D7B067A388638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D878D8A128D26F67FF8827A02EE1CC4C6B117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3733B5EC72352B9FA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BB07C9E286C61B7F975ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5811CA96A74DAD02160B6AF6DF0403E1F6983C42B3501723AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751B940EDA0DFB0535410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C264B329661203DA2C11FE84B16E24174A3E874AE7B639B6339DE9B020F63F9E8675AF33DC16790B1D7E09C32AA3244C15D85A8F8AAE174048D8102291DF7ED04DBEAD0ED6C55A80FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj9N286KAyvN6UnsBrvuDiPg== X-Mailru-Sender: 3B9A0136629DC912F4AABCEFC589C81E4F9168F06870D6D65A27F8D036F47B9EFC32C2461F02196FAD07DD1419AC565FA614486B47F28B67C5E079CCF3B0523AED31B7EB2E253A9E112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] Linux/ARM64: Make mremap() non-moving due to VA space woes. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Ostanevich via Tarantool-patches Reply-To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for explanation, LGTM. > On 2 Aug 2021, at 18:08, Sergey Kaplun wrote: > > Hi, Sergos! > > Thanks for the review! > > On 01.08.21, Sergey Ostanevich wrote: >> Hi! Thanks for the patch! >> >> Now direct_resize() will fail if it doesn't fit into the current place >> with a new size and a direct_alloc() supposedly will be called. This one >> doesn't help with 47-bit address AFAIU since it has no extra option - >> I doubt it exist at all - to ask kernel to fit. >> >> So, how it helps? > > For arm64 LJ_64 mode is enabled. > It means LJ_ALLOC_MMAP_PROBE is defined and for each huge allocation > `mmap_probe()` is called. This function tries several allocations > unless the limit (30) is reached, or any suitable address is found. > >> >> >> Regards, >> Sergos >> >> >>> On 1 Aug 2021, at 13:36, Igor Munkin wrote: >>> >>> Sergey, >>> >>> Thanks for the fixes! LGTM, except the single typo. >>> >>> On 28.07.21, Sergey Kaplun wrote: >>> >>> >>> >>>> >>>> The new commit message is the following: >>>> >>>> =================================================================== >>>> Linux/ARM64: Make mremap() non-moving due to VA space woes. >>>> >>>> This reduces overall performance on ARM64, but we have no choice. >>>> Linux kernel default userspace VA is 48 bit, but we'd need 47 bit. >>>> mremap() ignores address hints due to a kernel API issue. The mapping >>>> may move to an undesired address which will cause an assert or crash. >>>> >>>> Reported by Raymond W. Ko. >>>> >>>> (cherry picked from commit 67dbec82f4f05a416a78a560a726553beaa7a223) >>>> >>>> 47-bit VA space is required by LuaJIT for keeping a GC object pointer in >>>> TValue. In case of huge blobs that are mapped directly, `mremap()` may >>>> move the chunk out of 47-bit range of VA space on ARM64. `mremap()` >>>> accepts the fifth argument (new address hint) only with MREMAP_FIXED >>>> flag. In that case it unmaps any other mapping to specified address. >>>> >>>> To avoid this behaviour this patch restricts `mremap()` to relocate >>>> the mapping to a new virtual address by set CALL_MREMAP_NOMOVE flag >>> >>> Typo: s/set/setting/. >>> >>>> instead of CALL_MREMAP_MAYMOVE for arm64 architecture. >>>> >>>> Sergey Kaplun: >>>> * added the description and the test for the problem >>>> >>>> Needed for tarantool/tarantool#6154 >>> >>> Minor: Why #5629 is not mentioned? >>> >>>> =================================================================== >>>> >>> >>> >>> >>>> >>>> -- >>>> Best regards, >>>> Sergey Kaplun >>> >>> -- >>> Best regards, >>> IM >> > > -- > Best regards, > Sergey Kaplun