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 12D32C433F5 for ; Wed, 29 Sep 2021 16:10:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ABB8C615A2 for ; Wed, 29 Sep 2021 16:10:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ABB8C615A2 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 21F9994003F; Wed, 29 Sep 2021 12:10:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CF9D94003A; Wed, 29 Sep 2021 12:10:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 096A594003F; Wed, 29 Sep 2021 12:10:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id EAC4694003A for ; Wed, 29 Sep 2021 12:10:31 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B1B1C3017C for ; Wed, 29 Sep 2021 16:10:31 +0000 (UTC) X-FDA: 78641098662.32.4C6A63D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 3F886801A89C for ; Wed, 29 Sep 2021 16:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632931830; 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=WLMPpqPP550w7vqpI230ig8SxHeIacnrqJ+kTAlwAqE=; b=MfFiJPemGofziC2FHlapRKWxMrWPFhj4kV5jptfMJiaLpzfEMGX9Cir70Ant+TSE85ZrnZ bGD9qh+9RYtZJOVPyChftXxLXNmrbTV8AiDlKWRgVRCLLv1bMTml2JMOFM4AUlJLpD6LA1 Hb+QFEf36/Neq6pYqni0vQHZBO80Pj0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-Ed9BoRJZOhyvNHLC4CvphA-1; Wed, 29 Sep 2021 12:10:27 -0400 X-MC-Unique: Ed9BoRJZOhyvNHLC4CvphA-1 Received: by mail-wr1-f72.google.com with SMTP id h25-20020adfa4d9000000b001607d12a0b0so565279wrb.21 for ; Wed, 29 Sep 2021 09:10:27 -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=WLMPpqPP550w7vqpI230ig8SxHeIacnrqJ+kTAlwAqE=; b=7iT6U3p8NGS1kQ9RalCTtj+AspuXHQkImPheYNMfSkx7eE/ADWEj02cj8zPvtjl+A9 Nrn2bB8IShWo1tp6OnpOxmwUtzQDC61NG6gUIWQLIcRqM2NDo+MzttBRmgHvBsVHdo4u MH8nW8NhXAnyfkmy12GrsRcGU8mTsTf47P404J12YOq02XbQnU+dJSnVvONWJaVaPRyS ar7eGAYl2zOrcRwa3hYZe9kyp+Fz8mBs0enxV6Ug73IAXjg5U6MnkwvUqnlmiIm5hd4z f3SC0VPrWWPGSqPU8uqj9hkaPyLv20e1AzZu+Z58aYMazGYO473+oW+erwFbWCtRNSTQ 9IUg== X-Gm-Message-State: AOAM533PTiF//gCLFyIZn/i8UcdEbTTTA+xtNtbV5FlIf4Bh9yMNvQCy YdgIFWJFUuk5imQ50oSkIDyAEf3tgBmEYzZa508ezpsv8O/GzGK1FFILps5hUs6aaIb+nG4jefX adbr0uW3bj7SqDuiBQZJ2uSOb+gLGi57/VP3ngggFRT1uVi+kBszG8GBtN9Y= X-Received: by 2002:a5d:574c:: with SMTP id q12mr825478wrw.382.1632931826076; Wed, 29 Sep 2021 09:10:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZr1rHe13QhZNhdJKCME+MB4f6Kn7CxUGBW2vbFebu1x3OAb0Yf9fBK2OT6yZe0GK3vgIx4g== X-Received: by 2002:a5d:574c:: with SMTP id q12mr825426wrw.382.1632931825811; Wed, 29 Sep 2021 09:10:25 -0700 (PDT) Received: from [192.168.3.132] (p4ff23c3b.dip0.t-ipconnect.de. [79.242.60.59]) by smtp.gmail.com with ESMTPSA id g2sm349444wrb.20.2021.09.29.09.10.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Sep 2021 09:10:25 -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> <953ea84a-aabb-f64b-b417-ba60928430e0@redhat.com> <689b7c24-623d-c01e-6c0f-ad430f1fa3ae@redhat.com> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Wed, 29 Sep 2021 18:10:24 +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 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MfFiJPem; spf=none (imf06.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3F886801A89C X-Stat-Signature: jd3wy7eeewz3hffhgwhn9ajk3e8347yz X-HE-Tag: 1632931831-323073 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 18:08, Uladzislau Rezki wrote: >>> Could you please to be more specific? I mean how is it connected with huge >>> pages mappings? Huge-pages are which have order > 0. Or you mean that >>> a special alignments are needed for mapping huge pages? >> >> Let me try to clarify: >> >> >> KASAN does an exact allocation when onlining a memory block, >> __vmalloc_node_range() will try placing huge pages first, increasing the >> alignment to e.g., "1 << PMD_SHIFT". >> >> If we increase the search length in find_vmap_lowest_match(), that >> search will fail if the exact allocation is surrounded by other >> allocations. In that case, we won't place a huge page although we could >> -- because find_vmap_lowest_match() would be imprecise for alignments > >> PAGE_SIZE. >> >> >> Memory blocks we online/offline on x86 are at least 128MB. The KASAN >> "overhead" we have to allocate is 1/8 of that -- 16 MB, so essentially 8 >> huge pages. >> >> __vmalloc_node_range() will increase the alignment to 2MB to try placing >> huge pages first. find_vmap_lowest_match() will search within the given >> exact 16MB are a 18MB area (size + align), which won't work. So >> __vmalloc_node_range() will fallback to the original PAGE_SIZE alignment >> and shift=PAGE_SHIFT. >> >> __vmalloc_area_node() will set the set_vm_area_page_order effectively to >> 0 -- small pages. >> >> Does that make sense or am I missing something? >> > Thank you for clarification. OK, we come back anyway to the "problem" with fixed > range and an exact allocation plus a special alignment > PAGE_SIZE. Thus the > KASAN will not make use of huge pages mappings and go with regular instead > as a fallback path. But we would like to utilize huge-mappings for KASAN. > > I will send the patch you tested and add your "tested-by" tag. Does it > sound good? Feel free to add Tested-by: David Hildenbrand Reviewed-by: David Hildenbrand Thanks! -- Thanks, David / dhildenb