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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2D3C433EF for ; Wed, 29 Sep 2021 14:31:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E9C42613CE for ; Wed, 29 Sep 2021 14:31:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E9C42613CE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 03F3D94002B; Wed, 29 Sep 2021 10:31:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3065940020; Wed, 29 Sep 2021 10:31:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D83C994002B; Wed, 29 Sep 2021 10:31:29 -0400 (EDT) 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 C9170940020 for ; Wed, 29 Sep 2021 10:31:29 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8B3642C6BE for ; Wed, 29 Sep 2021 14:31:29 +0000 (UTC) X-FDA: 78640849098.09.9CABACD Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf13.hostedemail.com (Postfix) with ESMTP id 5474B1036A1E for ; Wed, 29 Sep 2021 14:31:29 +0000 (UTC) Received: by mail-ed1-f44.google.com with SMTP id v10so9480280edj.10 for ; Wed, 29 Sep 2021 07:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WsCHCHxDakoTG9Y2g1K3Qe4rx6KtRBr1u+T1pzACydY=; b=BtiXOGYER9YrYAItEdOx0vNMy5uSTK/hX3RVgLSZ3uQrBewz42OlOQXLZszFMwonC6 2CnMtHZIq9XG8Nt1q8iLw4zDw8rRX+a5W8qSx3KVzHKVnyy0V0CXnzWlBcMzwQ+rM5vx ZnhnWV6a7A4lj9HnXH//5QhKS9VPUzFZ5MLVKxk99FpaWTNfwt18rxzzmrjP8yw2Yv9p SyhZ3h5uoIOSVKmYPwYTcX3MFAxdzRAyi8OjHFmsJAHjzreZOVFiM5cNBzLDjegyptdm Di5UKwwORMBZimUezYaBz4lknCBuyWkvm9Jn919e75jLHolpEnzUADr0B1MMEFK9UX6x RvXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WsCHCHxDakoTG9Y2g1K3Qe4rx6KtRBr1u+T1pzACydY=; b=1b/6bSt2PWWe6bjh6VRlrvIRNNKyjCvK0Vpy8mtKZyB7pK85ID1w702xh0TQhU3yBB l2d0TyXuEtV4SUZSnP+3nvYXCNCrSXwM428rXUXhU2B21d09S0IlH7ge4cE/juU83UMm UOfF+6SbZ+Ics9u1csFMzQSazHDyGJZWF+4wc9CL6KrW7e87vCet4tZ0j+9tmMfcJjda bo2q3rqKguaQzGV5I2xPXvNc0Ncjqf+a7QYVI4aJpuaDnItBzR/RK5Mx5hfggloWmTxO I0sylhs+1YaGMGS1318Qv4c2YM1vHYOWd7LqEFz+b+x/F0qy7gOW2jcXWzJeRJOiLwa0 5oPQ== X-Gm-Message-State: AOAM531iPfHj83OOM1ax5bBsEfrfE1kxQD/unvKuUnR8HsLXiTbkocsm M2c5p+X69+YryYWDx0tjx+TVp2eACnHnvl4kgf0= X-Google-Smtp-Source: ABdhPJxZxYvDMm2YqTW1OjhvnqIVaBbe/F7hJ78SGcL9elgVQbdIzJFG1E61pzl9QLo4Znd0OxJJWvujOsMAvjgeCg0= X-Received: by 2002:a05:6402:142e:: with SMTP id c14mr207037edx.209.1632925850454; Wed, 29 Sep 2021 07:30:50 -0700 (PDT) MIME-Version: 1.0 References: <20210908132727.16165-1-david@redhat.com> <20210916193403.GA1940@pc638.lan> <221e38c1-4b8a-8608-455a-6bde544adaf0@redhat.com> <20210921221337.GA60191@pc638.lan> <7f62d710-ca85-7d33-332a-25ff88b5452f@redhat.com> <20210922104141.GA27011@pc638.lan> In-Reply-To: From: Uladzislau Rezki Date: Wed, 29 Sep 2021 16:30:39 +0200 Message-ID: Subject: Re: [PATCH v1] mm/vmalloc: fix exact allocations with an alignment > 1 To: David Hildenbrand Cc: LKML , Ping Fang , Andrew Morton , Roman Gushchin , Michal Hocko , Oscar Salvador , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5474B1036A1E X-Stat-Signature: 3faw3hfqxqocrx5hgknswz89w19is1pr Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BtiXOGYE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf13.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=urezki@gmail.com X-HE-Tag: 1632925889-624429 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000042, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > > So the idea is that once we run into a dead end because we took a left > subtree, we rollback to the next possible rigth subtree and try again. > If we run into another dead end, we repeat ... thus, this can now happen > more than once. > > I assume the only implication is that this can now be slower in some > corner cases with larger alignment, because it might take longer to find > something suitable. Fair enough. > Yep, your understanding is correct regarding the tree traversal. If no suitable block is found in left sub-tree we roll-back and check right one. So it can be(the scanning) more than one time. I did some performance analyzing using vmalloc test suite to figure out a performance loss for allocations with specific alignment. On that syntactic test i see approx. 30% of degradation: 2.225 microseconds vs 1.496 microseconds. That time includes both vmalloc() and vfree() calls. I do not consider it as a big degrade, but from the other hand we can still adjust the search length for alignments > one page: # add it on top of previous proposal and search length instead of size length = align > PAGE_SIZE ? size + align:size; in that case we solve a KASAN issue + do not introduce a degrade. For the PAGE_SIZE alignment all free blocks are aligned to it anyway. As for users which uses a fixed range that is same as a requested size and at the same time want to apply a special alignment is not considered as a common case, also we do not have such users. Thoughts? > > > > Could you please help and test the KASAN use case? > > Just tried it, works just fine with KASAN and makes sense in general, > thanks! > Good! Sorry for the delay. -- Uladzislau Rezki