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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham 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 9FDB3C4361B for ; Thu, 10 Dec 2020 23:46:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 246C72310E for ; Thu, 10 Dec 2020 23:46:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 246C72310E 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 82D1C6B0036; Thu, 10 Dec 2020 18:46:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 802F56B005D; Thu, 10 Dec 2020 18:46:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7416D6B0068; Thu, 10 Dec 2020 18:46:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 5DB1B6B0036 for ; Thu, 10 Dec 2020 18:46:58 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2E2721EF3 for ; Thu, 10 Dec 2020 23:46:58 +0000 (UTC) X-FDA: 77579010516.29.glove07_53149f5273fc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 0E2841808659F for ; Thu, 10 Dec 2020 23:46:58 +0000 (UTC) X-HE-Tag: glove07_53149f5273fc X-Filterd-Recvd-Size: 3956 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Dec 2020 23:46:57 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id 131so5713743pfb.9 for ; Thu, 10 Dec 2020 15:46:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=w62UaTHJLS+mblskAiHfL/RNuF/h3TtiJ3G/QJC1Q/k=; b=AfDQzRQtuuI6VnkwDh6ZHqDgcnWpA99zCSIZXsc4++1NxvYd3GAt1Waql4zakPyseD 3MkjCjq/jc+b4tqDSH3mU7+c7kroTPnLCcnGC+xqwwxwuHC0OaeFXhxdyRM3zHRPox78 2dyZakhG0xofHTKUpNMW7y6X4sSrls6wv/sn85q4zbxSZSax+MoW37KnU7caSygibQSo Z4GmX3GzVep59dYy1sNbk7+rFL2NSGqqAdr0Lyyj4rEiFY/VkqtnnQCjotvdh8pHAUCP 792FSqtSm+B3uI1h/JfkoPEUtRFoRYT4EtjTno1vGD3cSQk/IE1n1cCTt6qMdI/M64wI 6Vgg== 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:in-reply-to:message-id :references:mime-version; bh=w62UaTHJLS+mblskAiHfL/RNuF/h3TtiJ3G/QJC1Q/k=; b=sMRLtAwEn2+XuoOQF2VouAbaZ/ALT0C+aiy9ZmHHj1c1+f4VYkSsWmJbn0pz242d1s O16S7EZZqf3z1GDeyy7HOsIl83m+YKToop+KkkD1RvjpIP2YgqzoJtEIqscGOpSDun0Y +VWorUl1mGTz8xX7ptkR96SW1GWG3dEoNs+K+4Zij/sr+vP4nftBN0fqzkVmA6NczUbl lCHhQXOORu3w9OdY0J5QyADtVhJpBzEk/AVhmJuOAczH/ET4j2hstH4+xyoP7HSebcar s4ZaElzJyDt0YUslXXdJlqSVLRpOGRrkxGEq7DsdSFOOX36w+qoURZu2QOK4GblXPRLh uaBA== X-Gm-Message-State: AOAM531wjFLdOVbeM4dcSZ+BXzZWaWyPf2E7nOuTWnwQ/tEfy89PaJox oosgbd92ai1ZF3oPspeyAXHf/A== X-Google-Smtp-Source: ABdhPJyoXbsQaBYhneRdviEqrD1XTA+RUq/yp7oHNKys5BzY3M4lMP6otOolWpqr72EtFNqKLsz8zQ== X-Received: by 2002:a17:90a:cb8d:: with SMTP id a13mr10124105pju.155.1607644016547; Thu, 10 Dec 2020 15:46:56 -0800 (PST) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id a31sm1875631pgb.93.2020.12.10.15.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 15:46:55 -0800 (PST) Date: Thu, 10 Dec 2020 15:46:55 -0800 (PST) From: David Rientjes To: Vlastimil Babka cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , Joonsoo Kim , Matthew Wilcox Subject: Re: [PATCH] mm, slab, slub: clear the slab_cache field when freeing page In-Reply-To: <20201210160020.21562-1-vbabka@suse.cz> Message-ID: <56e5c740-2eaa-daa5-3df9-369f4d8be34a@google.com> References: <20201210160020.21562-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 Thu, 10 Dec 2020, Vlastimil Babka wrote: > The page allocator expects that page->mapping is NULL for a page being freed. > SLAB and SLUB use the slab_cache field which is in union with mapping, but > before freeing the page, the field is referenced with the "mapping" name when > set to NULL. > > It's IMHO more correct (albeit functionally the same) to use the slab_cache > name as that's the field we use in SL*B, and document why we clear it in a > comment (we don't clear fields such as s_mem or freelist, as page allocator > doesn't care about those). While using the 'mapping' name would automagically > keep the code correct if the unions in struct page changed, such changes should > be done consciously and needed changes evaluated - the comment should help with > that. > > Signed-off-by: Vlastimil Babka Acked-by: David Rientjes