Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758233AbcKCUd2 (ORCPT ); Thu, 3 Nov 2016 16:33:28 -0400 Received: from resqmta-ch2-02v.sys.comcast.net ([69.252.207.34]:34689 "EHLO resqmta-ch2-02v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbcKCUd1 (ORCPT ); Thu, 3 Nov 2016 16:33:27 -0400 Date: Thu, 3 Nov 2016 15:33:27 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: David Rientjes cc: Thomas Garnier , Pekka Enberg , Joonsoo Kim , Andrew Morton , Linux-MM , LKML , Greg Thelen , Vladimir Davydov , Michal Hocko Subject: Re: [PATCH v2] memcg: Prevent memcg caches to be both OFF_SLAB & OBJFREELIST_SLAB In-Reply-To: Message-ID: References: <1477939010-111710-1-git-send-email-thgarnie@google.com> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfDX4+HO1KF0ASExITO7iyMZ9KwO3ipNrUNteqPrQFvvSda9lqlVdHWXcr5k4LRkGFSM2O7ret5gRC+Q58PNsfBVse1hhoB5vDGr12mS/5ffD4AQ3w1hx liHtEF7/Qqbl7/IdfRN+7W7p3Q6yNheW2SLbyk0kYjdoJ36e+WiOSAS3ceqikfeHgwhAxKCqiwc1nCuq0JRDfcchZzCljWRoypoG2W6eQuUKnXU0ZeOYuEy6 UDNbVBWNkMXyJULF/IAVEUkfyxOAQeHHs2J0lrBXsTh3J/XjOnR/iRv0BWAlA/XVL+EJNRTBBlAUY+o0iqXW/deYq4DqoZLP1oTP9VBSYIEUodnwnZ8bDSAx /rUTz1TUQg+vE9KIJCGoY4DiTxD/xyfPny6gWHz42WUcDbmB3dyh5+us5UjHJIhQf/5QUWCM9gHJSJfg+ZGhNbFeEROVxJ79nzfD3ogUVaeYE65DrpI= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 840 Lines: 21 On Wed, 2 Nov 2016, David Rientjes wrote: > > Christoph on the first version advised removing invalid flags on the > > caller and checking they are correct in kmem_cache_create. The memcg > > path putting the wrong flags is through create_cache but I still used > > this approach. > > > > I think this is a rather trivial point since it doesn't matter if we clear > invalid flags on the caller or in the callee and obviously > kmem_cache_create() does it in the callee. In order to be correct we need to do the following: kmem_cache_create should check for invalid flags (and that includes internal alloocator flgs) being set and refuse to create the slab cache. memcg needs to call kmem_cache_create without any internal flags. I also want to make sure that there are no other callers that specify extraneou flags while we are at it.