Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp529112pxu; Fri, 11 Dec 2020 08:01:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkl9tccbezLDKUuKQKQEV5UKyZV9u1YWgDjrNzTYdEiq8YVC44OuFdbUSlu+9sjkmf38b9 X-Received: by 2002:a50:bacb:: with SMTP id x69mr12363896ede.39.1607702479377; Fri, 11 Dec 2020 08:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607702479; cv=none; d=google.com; s=arc-20160816; b=xy5RWDEaqWEBj7bUCz01/pW3Di/AhC3xL69L71f1SyE2g+gxMuargLw7BSjZ+8hyDI rYkfudIzb2N0Jfib0Q+rPy8GmzGvdeSXLyFi9PgOabeH+icygrmUxh+P+eUCK94IjbXh VC/6ShZma+hFMQiMV5psYQ1T1fxeiD6GCD8Asz8LmVIXSMk/vPocPG+azM+7JY5XWudg vVOu84Qxtky1mVsTWA+rTcSA9ZyZSAAjgvzFVHwS8UBEakQNtDOWPUc17Q7cjeVV15QU /ZA9hO30UXLkhdgg4LJhFPH/FY7hLEchOxwhbYHjHwc8mzXEJPAffyNhTrGW1YXmoT2i tJeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=w62UaTHJLS+mblskAiHfL/RNuF/h3TtiJ3G/QJC1Q/k=; b=iClPcQtqBjYTKTa9N3k0qJKsSOGPNmWMWTlVepqmJDMvWEm22e0IuMysAJiQwGs2BS athbe7thie8VBlRmwJOj0AMsMpPkEtBzHxEDAThHgYbSOwN6rjNFWsASdHYqWUEYiy4c mR9rQWsSiCCC6pEFz+puBcOa2cAisd0jPGZ5tXikbScYGjSdh5Rv3QummqEsHPxmlZYj fH5Kp9g59MpzwkcntEId6Jt/0RIiFsBciYMiqpC2Ca5ixRhmqJTrgNTnVwe3OLDeRmNY FVhvR95hWtvmW19aqxBO4wU5HTZPocuAR5QjQ8ZSTDdGu3obPYji6AKRlaht1Bg9YWjf zHIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AfDQzRQt; 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 bi10si5358620edb.483.2020.12.11.08.00.54; Fri, 11 Dec 2020 08:01:19 -0800 (PST) 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=AfDQzRQt; 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 S1728027AbgLJXsS (ORCPT + 99 others); Thu, 10 Dec 2020 18:48:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389435AbgLJXrh (ORCPT ); Thu, 10 Dec 2020 18:47:37 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22975C0613CF for ; Thu, 10 Dec 2020 15:46:57 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id v29so5799357pgk.12 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=e2naAfHa7yOMglubALC+YoAO2E12y7G2iT8Fvk6p5JPvMbw0whKZgST9dW/87Kpm2U V5W2vZtXrbu4WQ8D950/FRJcKvwsVr+Prq4J7ROjAytQcULL7XhugPm9fTMMN8dzwueo oA8UqeobtRbrZsWFue10kBH92VyzAbE/209uGNLb8WNrocXB+WkFHSy3mr4TpxhNnSPu EwCOLBs0Nz3wFmtTJmXLfWX/nAeuaJ9XFi+sSQME5TfUfr50kqI/e4u8VYjQQ+cYSU75 p9qzkD3jfF0Y2FbGo4/77C54yHV5olOgYG/doovmXtiGglAW3cEznYHHBXkXDYA3uPUs Ekyg== X-Gm-Message-State: AOAM531UFGZYk5CCfmC6CW0kNvXz6h3pdRyM6E489pL+Ty52Okak8SW8 mIVWz+TkpFdofZE8pU4PbUjOtiLDL/ERLg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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