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 5E9A8C433EF for ; Wed, 29 Sep 2021 14:40:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB31D61288 for ; Wed, 29 Sep 2021 14:40:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB31D61288 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 84E50940034; Wed, 29 Sep 2021 10:40:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FC95940020; Wed, 29 Sep 2021 10:40:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C41A940034; Wed, 29 Sep 2021 10:40:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id 5D191940020 for ; Wed, 29 Sep 2021 10:40:06 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 14050181CA338 for ; Wed, 29 Sep 2021 14:40:06 +0000 (UTC) X-FDA: 78640870812.13.E36E393 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 61D4F6001997 for ; Wed, 29 Sep 2021 14:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632926404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RTohnJEVaRgmsE21p0PUf/a8BihysPGpVmzSuoYF6Kc=; b=Y5lDUFxfZCsXy5O+MvQRAujtSiRsoc85ThbU2MoUcVUse1bL03/dv6uvJfagfyyF3vwFSH BmpGZXXm5ANBtSUAzCBZbMG4yCobksjHRVFvLG0XPrw/GrKAlzmetT6l8ZjYq6M/r02Mcx XkvnMs+eFhuQRDymmQhK/foBi2IU3tw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-66-gWcIS9-hMv2tF7DFlT_xhw-1; Wed, 29 Sep 2021 10:40:03 -0400 X-MC-Unique: gWcIS9-hMv2tF7DFlT_xhw-1 Received: by mail-wr1-f71.google.com with SMTP id j15-20020a5d564f000000b00160698bf7e9so677654wrw.13 for ; Wed, 29 Sep 2021 07:40:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=RTohnJEVaRgmsE21p0PUf/a8BihysPGpVmzSuoYF6Kc=; b=HTafImwgOmyuOaxI5v6I8onaOZ2Moucw3hcuvloq89OjxCoQUs+2XTF8I0GW2lWoGw dACUfhOsEvRChHmnpKGyyF7BLTkcRhND2OdS1ibLO7VbLjUa0K2SHG0Ur7kzMMEEqUQG lAj0+iRGvO6jaeHWBhHGxzoSQ4BauMV1owmdDPhACGEuY1L56TQCvcDUEOBoaj6rVb/j 0keNoxmNF/EFJQ75qRoTMiutVoKhdCYvgJ0p/+Q8X8k93tmT8eyqZDfTtpFEhC2JU5Bz HnwghMg1Lh+y0d6/uQM+3dNoZi3hgcXDa6LRMQ/qRrS2Dy1yaz1DuVADSOPHRuYN69Yc 9ysA== X-Gm-Message-State: AOAM532eR6xk+gBQX+a8b41D1vFBrpQOASSzq1wI2DyRqdR5C42LiG5A T8Z4uWDAOE+bfESGacN0JvOMQeKuoKqAfFr/c1XMM/65Fa/ABDBlWKQWfvRZ0pzi23c8RLpYY+/ FSQINHMdeIERS2wgguXcHHAewtP70F2xmjZur7Kv+y/FqT54Gx4y/DEaTOVU= X-Received: by 2002:a1c:7f11:: with SMTP id a17mr10831962wmd.166.1632926402242; Wed, 29 Sep 2021 07:40:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL+KrZvzNDfBushKo4he0hLbt3uOFSVXpNF30x8fkTZQ/hUEAzG4H0Yap4j9KgNoD3atKEHw== X-Received: by 2002:a1c:7f11:: with SMTP id a17mr10831921wmd.166.1632926401991; Wed, 29 Sep 2021 07:40:01 -0700 (PDT) Received: from [192.168.3.132] (p4ff23c3b.dip0.t-ipconnect.de. [79.242.60.59]) by smtp.gmail.com with ESMTPSA id n26sm1871649wmi.43.2021.09.29.07.40.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Sep 2021 07:40:01 -0700 (PDT) Subject: Re: [PATCH v1] mm/vmalloc: fix exact allocations with an alignment > 1 To: Uladzislau Rezki Cc: LKML , Ping Fang , Andrew Morton , Roman Gushchin , Michal Hocko , Oscar Salvador , Linux Memory Management List 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> From: David Hildenbrand Organization: Red Hat Message-ID: <953ea84a-aabb-f64b-b417-ba60928430e0@redhat.com> Date: Wed, 29 Sep 2021 16:40:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 61D4F6001997 X-Stat-Signature: ts6io879ijqsitkp9m87gqxcegq3grnu Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y5lDUFxf; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf10.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1632926405-403220 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 29.09.21 16:30, Uladzislau Rezki wrote: >> >> 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: How realistic is that test case? I assume most alignment we're dealing with is: * 1/PAGE_SIZE * huge page size (for automatic huge page placing) > > 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; That will not allow to place huge pages in the case of kasan. And I consider that more important than optimizing a syntactic test :) My 2 cents. -- Thanks, David / dhildenb