Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3782720pxk; Tue, 29 Sep 2020 06:15:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV0nPWdD2P10ZWXVYJesHmDu2QGd+4otm+y9bdKEB6c3AurO2l3YK2GmXexUaWpex2Ki9h X-Received: by 2002:aa7:c896:: with SMTP id p22mr3141853eds.382.1601385311781; Tue, 29 Sep 2020 06:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601385311; cv=none; d=google.com; s=arc-20160816; b=ZfZyFKAPBUZcKCSF6APZ/5JNwqmoKUMABqZY/dI8/P1UQphT8rnJY8RePpskWb35rZ pSOulcjR/Ph+8cuUeaa79LKeUxDQIeFpb+K2DIfjjYAe1O5B8EKWqnJcmZ1rHFRg+nux 6Twd5sfbbjrr525dMB0PCTxJ8FhM9JKBDLi6LV2AfQywXDJOID3GmLmMqQKEnoK4LUTO ptUaP7hDA82Q51Z5Kh3jwiOjgimoual9C2NGp2NYKnotpw9zX5G82mk4LlC4yln80sUd E8a+70TRseJY8fX7vzvbmvGA+jBYU98CadkAbfSagVJUtqvUz/jkMz4CXSRi1tkxnCaZ SsSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=4Zoo7sR5M5htbvHNu3bicEUq1AAqj0gs6k4W5/ci+9Q=; b=wcl3BtA+0nDniL098KbZeW3lugT1Of9a1Z6zAe/I4BAZBdURf+kWAyCZGeNGYFfE2O ZR4vgxisQNhHoQ6dKx3XTjt8QqFZ+Q9y6r3C3DeuOhg7mgRbNdsOSEYNyDiqoHPGaPFN NXPGA9324GujLM7Klj0aIm0Jq7G1N/8I/FtArDqidSwV0CtymyifzpQtmVYbiFh0RdJc Ws7oYjpPVZCuF/7nCf2ae/tjqiYTINx6wBxmM3ntrXKisKL3IOS2TMzBRoVeC4CoFvo9 fR8TAldSVdKW8LzKCjevI6c69NEg+PGK1/I3Hl/va4+6iKAEeyYBpYhd+LM0MhuDntT2 oUMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RNHLBk7i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id df5si3018250edb.398.2020.09.29.06.14.48; Tue, 29 Sep 2020 06:15:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RNHLBk7i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728879AbgI2NLp (ORCPT + 99 others); Tue, 29 Sep 2020 09:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbgI2NLp (ORCPT ); Tue, 29 Sep 2020 09:11:45 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6E5DC061755 for ; Tue, 29 Sep 2020 06:11:44 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id m6so5375670wrn.0 for ; Tue, 29 Sep 2020 06:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4Zoo7sR5M5htbvHNu3bicEUq1AAqj0gs6k4W5/ci+9Q=; b=RNHLBk7i6XR1zMD1p4N6ZqYbYyWG4mssQ7O+gFffzxxHmle0A5/U9YEwjGVqZWhUxh DQIl7RGT3z8N78DcH5EToKU6xktWeegW2yJKIm4P5N6M21o0mJ3HRdLVZAjWadYujsYm XFeSekc+TLgmk0Qxu95Y4U0aXOcie3bPgpcwTA+g/292Vx3HkNq2xn1D2jnkpVDS8d+7 DBl/WzKaHleY9+rrQpEls6TZBtK9635dKBhL5g0rX+RSs7NLDM3660UnFWAT71UVVLdH GrqoUwjZAa6ubaJFcQETRsYLcVH5q22Dnp0s8CQSTEGcZx103ImXkF5fZc7VFh85HATD +eSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4Zoo7sR5M5htbvHNu3bicEUq1AAqj0gs6k4W5/ci+9Q=; b=Knfi4mUV8rBTzamofGRiEk8WoXom1U2MRFfc/cqUuLK29i77Sswwm/uZXyRDl9DcuJ EUcQdObKq1LmcA8nB4fluGZtyLRdFDn7mVoHUVfeoXQnjFHpw6ZYL87yMPBT5urD/Q23 0qGtAZ+WlD6GU9qJ4yx9RCYGR4s7pXCioIs8A7DoTbO2e6eo6sg0cN/uk97ntGNgyVFV yHoUR91G5TywOY30lGTJAANnQyiYo1HZCKg8InueZYeN2Jcmn7uw6zQPTWaZ/+/V2Bex +4N7CeZzxPs9cqqhdbDZI4eFKui7mxzi4kwoSoz3jceZ7ygYnPqrcv8P4qwjkw9WI6Bw 5T0w== X-Gm-Message-State: AOAM530O0UN1aGl7pMkR8FK2WMAxxeuNtjmdik/5FeuP5f/cgom9L6cr bYYmUp6iABnX0070Rm1bWZBMgw== X-Received: by 2002:adf:ee01:: with SMTP id y1mr4452655wrn.2.1601385102792; Tue, 29 Sep 2020 06:11:42 -0700 (PDT) Received: from elver.google.com ([100.105.32.75]) by smtp.gmail.com with ESMTPSA id s12sm5024777wmd.20.2020.09.29.06.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 06:11:41 -0700 (PDT) Date: Tue, 29 Sep 2020 15:11:35 +0200 From: Marco Elver To: Andrey Konovalov Cc: Andrew Morton , Alexander Potapenko , "H. Peter Anvin" , "Paul E . McKenney" , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jann Horn , Jonathan.Cameron@huawei.com, Jonathan Corbet , Joonsoo Kim , Kees Cook , Mark Rutland , Pekka Enberg , Peter Zijlstra , sjpark@amazon.com, Thomas Gleixner , Vlastimil Babka , Will Deacon , the arch/x86 maintainers , "open list:DOCUMENTATION" , LKML , kasan-dev , Linux ARM , Linux Memory Management List Subject: Re: [PATCH v3 01/10] mm: add Kernel Electric-Fence infrastructure Message-ID: <20200929131135.GA2822082@elver.google.com> References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-2-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.14.4 (2020-06-18) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 02:42PM +0200, Andrey Konovalov wrote: [...] > > + */ > > + index = (addr - (unsigned long)__kfence_pool) / (PAGE_SIZE * 2) - 1; > > Why do we subtract 1 here? We do have the metadata entry reserved for something? Above the declaration of __kfence_pool it says: * We allocate an even number of pages, as it simplifies calculations to map * address to metadata indices; effectively, the very first page serves as an * extended guard page, but otherwise has no special purpose. Hopefully that clarifies the `- 1` here. [...] > > + /* Allocation and free stack information. */ > > + int num_alloc_stack; > > + int num_free_stack; > > + unsigned long alloc_stack[KFENCE_STACK_DEPTH]; > > + unsigned long free_stack[KFENCE_STACK_DEPTH]; > > It was a concious decision to not use stackdepot, right? Perhaps it > makes sense to document the reason somewhere. Yes; we want to avoid the dynamic allocations that stackdepot does. [...] Thanks, -- Marco