From: Andrey Konovalov <andreyknvl@gmail.com>
To: Marco Elver <elver@google.com>
Cc: andrey.konovalov@linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
kasan-dev@googlegroups.com, Peter Collingbourne <pcc@google.com>,
Evgenii Stepanov <eugenis@google.com>,
Florian Mayer <fmayer@google.com>, Jann Horn <jannh@google.com>,
Mark Brand <markbrand@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrey Konovalov <andreyknvl@google.com>
Subject: Re: [PATCH v3] kasan: allow sampling page_alloc allocations for HW_TAGS
Date: Mon, 19 Dec 2022 19:08:59 +0100 [thread overview]
Message-ID: <CA+fCnZcDEV4hmeyLb6paTvR7Z3gjQOTJn_M9wTMN-cy+9DKUTw@mail.gmail.com> (raw)
In-Reply-To: <CANpmjNPKYEohPBnQ59GVKfCYc+dRUo-YtaR0PzPiwtALNghdFA@mail.gmail.com>
On Mon, Dec 19, 2022 at 12:31 PM Marco Elver <elver@google.com> wrote:
>
> On a whole:
>
> Reviewed-by: Marco Elver <elver@google.com>
>
> This looks much better, given it'll automatically do the right thing
> without marking costly allocation sites.
Agreed, thank you for the suggestion!
> > +- ``kasan.page_alloc.sample.order=<minimum page order>`` specifies the minimum
> > + order of allocations that are affected by sampling (default: ``3``).
> > + Only applies when ``kasan.page_alloc.sample`` is set to a non-default value.
>
> "set to a value greater than 1"? The additional indirection through
> "non-default" seems unnecessary.
Will fix in v4.
> > + This parameter is intended to allow sampling only large page_alloc
> > + allocations, which is the biggest source of the performace overhead.
>
> s/performace/performance/
Will fix in v4.
> > --- a/mm/kasan/hw_tags.c
> > +++ b/mm/kasan/hw_tags.c
> > @@ -59,6 +59,24 @@ EXPORT_SYMBOL_GPL(kasan_mode);
> > /* Whether to enable vmalloc tagging. */
> > DEFINE_STATIC_KEY_TRUE(kasan_flag_vmalloc);
> >
> > +#define PAGE_ALLOC_SAMPLE_DEFAULT 1
> > +#define PAGE_ALLOC_SAMPLE_ORDER_DEFAULT 3
>
> Why not just set it to PAGE_ALLOC_COSTLY_ORDER?
I've been thinking about this, but technically PAGE_ALLOC_COSTLY_ORDER
is related to allocations that are costly to service due to
fragmentation/reclaim-related issues. We also don't rely on
PAGE_ALLOC_COSTLY_ORDER only, but also on SKB_FRAG_PAGE_ORDER. (I
guess some clean-up is possible wrt these constants: I suspect both
have the same value for the same reason. But I don't want to attempt
it with this patch. )
We could add a BUILD_BUG_ON that makes sure that all 3 constants are
the same. But then the only thing to do if one of them is changed is
to remove the BUG_ON, which doesn't seem very useful.
I'll leave the current implementation in v4.
Thank you, Marco!
prev parent reply other threads:[~2022-12-19 18:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 22:16 andrey.konovalov
2022-12-19 11:30 ` Marco Elver
2022-12-19 18:08 ` Andrey Konovalov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+fCnZcDEV4hmeyLb6paTvR7Z3gjQOTJn_M9wTMN-cy+9DKUTw@mail.gmail.com \
--to=andreyknvl@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andrey.konovalov@linux.dev \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=eugenis@google.com \
--cc=fmayer@google.com \
--cc=glider@google.com \
--cc=jannh@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=markbrand@google.com \
--cc=pcc@google.com \
--cc=ryabinin.a.a@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox