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 X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1452FC5519F for ; Thu, 12 Nov 2020 20:11:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7AC2B22201 for ; Thu, 12 Nov 2020 20:11:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RNW8PZ9+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AC2B22201 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 83BA06B005C; Thu, 12 Nov 2020 15:11:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C38F6B005D; Thu, 12 Nov 2020 15:11:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68C036B0068; Thu, 12 Nov 2020 15:11:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 32FF86B005C for ; Thu, 12 Nov 2020 15:11:57 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C7A8C8249980 for ; Thu, 12 Nov 2020 20:11:56 +0000 (UTC) X-FDA: 77476862232.03.feast03_0f0592727309 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 9A57428A4E8 for ; Thu, 12 Nov 2020 20:11:56 +0000 (UTC) X-HE-Tag: feast03_0f0592727309 X-Filterd-Recvd-Size: 4166 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 20:11:56 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id y22so3370477plr.6 for ; Thu, 12 Nov 2020 12:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2S2n4Y93UoJG9nL/klprM8z9XQcvbrv6CcFxLYZgtjg=; b=RNW8PZ9+tID0QSbR+rpTOcvI3kI7ebx4DXx6gAvjzcH3TLPaxKEz9At/oTpE9K3eWk zLQYhMMGcOz5YFxKA8FTnfipVDwDqCSZ/1QeqvUxu5ccf+qWzPAZSyWb68SjN3RR3wDF yyfJxNDonQnDg/+1fR5dfNMdh+RhSEexdb2rj3NJGdrmrqCelZde4KfnMZ2li6NUouwM k2wI0oK6L4GvBGymy315Vdo9dJqgnzWCOy47TCt3j+uFCcJUoDFeFLigu9N0vm8TR+Bz Oq9sGnU+Q4Hm6eQUbUcOL7tNrMQwydrYcSNUfuWs/v7i6OelIwjhENz9qIKbXUQOh2Rs p7+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2S2n4Y93UoJG9nL/klprM8z9XQcvbrv6CcFxLYZgtjg=; b=QewFyXVHBPtplRVFuvPUrcRe8ygZHxtqAiEI2u8jlJ1iA5mqOEzRV/CDII1HtDf3dU DY6Xg305e4dDBBuii5AYiU2gNES+FkBwi1XLoFw3cEQlU+IA4ArUK/qAictjMxXPBqv0 Bc0NVMrkTsNIZTSLPHGy2f4wYCNPVVvCeDB7tJegye+o7YIDurIjt2yb2N8xRm05Og3Q GuyuNxetE7LONLOgRlqxUBEhnZ+9JUjGK6ZzCy+HzqSAGtEhmLx0ZcGILcl/ZUIybmbl R6VCuynssSLnoZin9oNfjBjJsdV0AWr+6u5j68R46uXqLwrfvQXQ1mj9y2vOq41dhkqb hm8Q== X-Gm-Message-State: AOAM531RR3HaBxWhXZzGHNc/29uwwGH3Xedga8Jr89BpsE97xEyll8Pz ah0Xdw+Xwk3prh4ZSFqGZUOa4HaaYqV/4fZVQfBqjQ== X-Google-Smtp-Source: ABdhPJyQBAUXMmBZ3y1Mo+CJ+E5TUtrYfPLbY6wFDednABZ3IRhP/lxtBA0vTrNnfgnZYvuJFasFHpexl/ZMb46edN4= X-Received: by 2002:a17:902:d90d:b029:d6:ecf9:c1dd with SMTP id c13-20020a170902d90db02900d6ecf9c1ddmr902814plz.13.1605211915059; Thu, 12 Nov 2020 12:11:55 -0800 (PST) MIME-Version: 1.0 References: <20201111230601.GA984367@elver.google.com> In-Reply-To: <20201111230601.GA984367@elver.google.com> From: Andrey Konovalov Date: Thu, 12 Nov 2020 21:11:43 +0100 Message-ID: Subject: Re: [PATCH v2 18/20] kasan: clean up metadata allocation and usage To: Marco Elver Cc: Dmitry Vyukov , Alexander Potapenko , Catalin Marinas , Will Deacon , Vincenzo Frascino , Evgenii Stepanov , Andrey Ryabinin , Branislav Rankov , Kevin Brodsky , Andrew Morton , kasan-dev , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000382, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Nov 12, 2020 at 12:06 AM Marco Elver wrote: > > > + /* Limit it with KMALLOC_MAX_SIZE (relevant for SLAB only). */ > > + if (optimal_size > KMALLOC_MAX_SIZE) > > + optimal_size = KMALLOC_MAX_SIZE; > > + /* Use optimal size if the size with added metas is not large enough. */ > > Uses the optimal size if it's not "too large" rather than "not large > enough", right? Not really. If the redzone composed from metas is begger than optimal redzone - we're good. If it's not large enough to reach optimal redzone - we need to make it bigger. > As it is worded now makes me think this is a fallback, > whereas ideally it's the common case, right? It's hard to say which case is more common, as optimal redzone size varies and depends on the object size. [...] Will fix the rest of the comments, thanks!