Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp843810imm; Fri, 29 Jun 2018 07:18:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdK81zzovTtPoGRSwiM8NU9VIUmDVDD9PDsT4pJcFGqZaTbGrVD0zXBLP22EJUw+UqeHtuq X-Received: by 2002:a63:a919:: with SMTP id u25-v6mr1916050pge.211.1530281924648; Fri, 29 Jun 2018 07:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530281924; cv=none; d=google.com; s=arc-20160816; b=x/bJADUQgYYXvF6PbMN2NrkyVRmYdjUDOFxfUehmydL7TWVEWeT2iUgtYalQrCfLQx gl2YqbeNzncg8chlZVjeRSmtI8SeHDlpbu0sQyRWFOnes6ghnFRDPuGHQ0LF83rsYQ8w RU622tGY7Y3Me/3D2qSIYmL3E2dsxYCBOVSsU2v9W+qbiWDJd6G+B6U/3f554Mz4iQ7o PNUpa3Z8W7RubnC3MKU7pJqcZ3m6cjwVFpyB+Qa56rE7AfWl4V0ZR06BcVTd4XDw0Wmh zY8knhRut2sk7ncU/a9hvAj/PbE6rYigAAaZgD/wiomX0pjSJP3JNyf6Ni0bmNCjPDVU W/eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=2L8jTjtLtHQSNVQv6Mns8k+CBKnTFLV5Zm0q+pEDcJk=; b=n1xMZHd+u82B8755SG1JQjycSU/92CenfD5BvZ/9lPLsPNxr/HJTvRzSZPenbLbn2H qJ6kPVbjNmDgDuvearyZMhyg2EAYZOwdVzHVlT/J/tKa57US+tG6/6C/unZ8BC/tOSh/ r4Nc7XYAz/LlD46OKZglcMspcN7V2zSUhKQitcRd3smuPQKzYckMyB0NnyL4w3JQcFa/ oxgaRWqnY7vigHY53EZnu5DZC+Zx999qtXp5XYn6Qc3RSJLKBHg6//UW0DKa0PT52egl jy8kbQMoPu95c+SSY6A1YgWU5k2qdHd8N+hXCbmKMmon9ES1/wq3xWSwyL2atUeOIUxE uRrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="u4z8/lxk"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w14-v6si7415292pgm.502.2018.06.29.07.18.30; Fri, 29 Jun 2018 07:18:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="u4z8/lxk"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934837AbeF2MpO (ORCPT + 99 others); Fri, 29 Jun 2018 08:45:14 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:53699 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934369AbeF2MpJ (ORCPT ); Fri, 29 Jun 2018 08:45:09 -0400 Received: by mail-it0-f68.google.com with SMTP id a195-v6so2650050itd.3 for ; Fri, 29 Jun 2018 05:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2L8jTjtLtHQSNVQv6Mns8k+CBKnTFLV5Zm0q+pEDcJk=; b=u4z8/lxktq9wCjgY3H5dn8NA5BV9caRBfKx96G+knkGLKML/D6nh1cnq52drQyWZYH C325JKvy9dWa8SeRBMbf4+ADxVGFScValCpcgK/6b8A2iCny3UmtJvtRMBrfJHlAcHa3 6RNbBroGd5xeQ0kY00MxTCdFoIfe9mpUMt/XWU/VRXcBKKP0GRwpHizlCNTytOKWra7A 7NvTIHbVsUwu2+PHNtdRRGZRzqhq6Nu5y/V28skWFsyj+iRLdbdvi62ExkhkivPEq2H+ /B31R5BfKz6yjQikgHLuN2DZwRkGF+SDcU+Uk7zB6FaisCgmTrTwiTBx+RdXzhtkhEr5 5zjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2L8jTjtLtHQSNVQv6Mns8k+CBKnTFLV5Zm0q+pEDcJk=; b=JTYwCxjc7lv54ClIVnoaC+IEVvyYyAVJ8oFQ/KdmODxQ3RyQo2tv4uZmUl0Gz90fpH SbvlCoEExTuoeLIan3XuEvdNIyu4/yypTBLzfUw2pTMtD1UVW8rxAHcJrq7ow3EsSeBB V3rUx/DUG8qrrexAy58wfAI3YKso9Asftmp1Fsj5H+nCMxYmtsgrVaNs3MjVTb9TxEBb JouqD3boKceWUZXiDGElDtMtdTtt44TzJyplCbvRgHdTef40VO+caCbGNUp42RRWIcYI nCwZ+ulYTFnrGOp6WMSLmS8eFApze8Ntwu/ue0cntt7mMzDSIHDJ/al9ogNtHda5QIe8 malg== X-Gm-Message-State: APt69E3tTpJovnDIvAoXc25vQLX/DoM+tGZqDb3JEmfjpdQWlOPmb6YV 7EV40UvHb6nESYeSKOO5pLQBTjFcNmFL4MAaHAqHKQ== X-Received: by 2002:a24:b046:: with SMTP id b6-v6mr1725612itj.48.1530276308783; Fri, 29 Jun 2018 05:45:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:9082:0:0:0:0:0 with HTTP; Fri, 29 Jun 2018 05:45:08 -0700 (PDT) In-Reply-To: <20180628124039.8a42ab5e2994fb2876ff4f75@linux-foundation.org> References: <20180627160800.3dc7f9ee41c0badbf7342520@linux-foundation.org> <20180628124039.8a42ab5e2994fb2876ff4f75@linux-foundation.org> From: Andrey Konovalov Date: Fri, 29 Jun 2018 14:45:08 +0200 Message-ID: Subject: Re: [PATCH v4 00/17] khwasan: kernel hardware assisted address sanitizer To: Andrew Morton Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 9:40 PM, Andrew Morton wrote: > On Thu, 28 Jun 2018 20:29:07 +0200 Andrey Konovalov wrote: > >> >> Slab memory usage after boot [2]: >> >> * ~40 kb for clean kernel >> >> * ~105 kb + 1/8th shadow ~= 118 kb for KASAN >> >> * ~47 kb + 1/16th shadow ~= 50 kb for KHWASAN >> >> >> >> Network performance [3]: >> >> * 8.33 Gbits/sec for clean kernel >> >> * 3.17 Gbits/sec for KASAN >> >> * 2.85 Gbits/sec for KHWASAN >> >> >> >> Note, that KHWASAN (compared to KASAN) doesn't require quarantine. >> >> >> >> [1] Time before the ext4 driver is initialized. >> >> [2] Measured as `cat /proc/meminfo | grep Slab`. >> >> [3] Measured as `iperf -s & iperf -c 127.0.0.1 -t 30`. >> > >> > The above doesn't actually demonstrate the whole point of the >> > patchset: to reduce KASAN's very high memory consumption? >> >> You mean that memory usage numbers collected after boot don't give a >> representative picture of actual memory consumption on real workloads? >> >> What kind of memory consumption testing would you like to see? > > Well, 100kb or so is a teeny amount on virtually any machine. I'm > assuming the savings are (much) more significant once the machine gets > loaded up and doing work? So with clean kernel after boot we get 40 kb memory usage. With KASAN it is ~120 kb, which is 200% overhead. With KHWASAN it's 50 kb, which is 25% overhead. This should approximately scale to any amounts of used slab memory. For example with 100 mb memory usage we would get +200 mb for KASAN and +25 mb with KHWASAN. (And KASAN also requires quarantine for better use-after-free detection). I can explicitly mention the overhead in %s in the changelog. If you think it makes sense, I can also make separate measurements with some workload. What kind of workload should I use?