From patchwork Wed Jul 18 13:36:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 10532473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25878601D2 for ; Wed, 18 Jul 2018 13:36:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16403292E3 for ; Wed, 18 Jul 2018 13:36:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09F3C293D1; Wed, 18 Jul 2018 13:36:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7061292E3 for ; Wed, 18 Jul 2018 13:36:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EAE26B0006; Wed, 18 Jul 2018 09:36:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 897FE6B0008; Wed, 18 Jul 2018 09:36:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74EE76B000A; Wed, 18 Jul 2018 09:36:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 276E16B0006 for ; Wed, 18 Jul 2018 09:36:31 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id i26-v6so1956816edr.4 for ; Wed, 18 Jul 2018 06:36:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=CnniiSWxY3paOgDOvI1YCAZukBWlLSLf+XLT17roP6I=; b=qnFF8RwhhxyO8kHMY0Ctb9UJyMWBz0cDqFLSNkjIhGkTXQgaULBrI2OuqW8Sf9fGSd w2jNOUIKW1EDNQD3hrtfWTRHf2cPfKB0gNLKsACKV5PYNy/ytfwXR24GMxXjrmgj0gnM r+jgssqJ8SqHvKnAlnLZmBOl9uGwZc6QzQMHDcpUacH1H1JX2gByExbN6XVf+JVxF1ky s/9h+p59COUdt0gXg5c6Nwl3f96VHIBWjJfpErQz3SfIDFWHcx3lohZRjauF7byStbvS 69vvJl7+Qr8OCL12+nKNFjyNQqB71wijrfZo2k6DMVYQhpTVT2qmvbRbqmcv+/GEFuSf oLbw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Gm-Message-State: AOUpUlHnYmbe9IInsODpMbE1tkpj/5ENRprUstuIwjd76b+HukoAnsS5 3QjSSGSFVBbicIf89fwnQnmG15OHqE0DwLFXyUH+1z6hVj/hKAmaZ3PL4NBKyR2GtXl1Wo9kL4F UEQFBwRrXTJlt46iZPRlx6WEK9KSy512blVfZ5aUNMa2YYKttKz9CLtRVscxYrS0/SQ== X-Received: by 2002:a50:a5d8:: with SMTP id b24-v6mr7101336edc.235.1531920990629; Wed, 18 Jul 2018 06:36:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeixnZSm7DYbs59KLWFwr9JAavrj4w8/2I5YHllgpKNosKt3x5qOcv1gT3Ti8SnhyxcyzxR X-Received: by 2002:a50:a5d8:: with SMTP id b24-v6mr7101282edc.235.1531920989821; Wed, 18 Jul 2018 06:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531920989; cv=none; d=google.com; s=arc-20160816; b=ix2bL4rAYtmDkeAjVpw8WkC8a8Id8QUxZOZlbicN6R8SJH89+j9ghzee4a0mLiuGvG nYjgxFtI0A6wX7RkyJyHyjUhTKod1ZLso3BVRFIBeMjRZPfBihAZNWYinpXWB7Oh1iOy xGqKsDyT/sv7jdSdYdtoDimk/qUleavST5WaPMNgTbRdNF44A6Owf0lbppfbjFD3X2xY iGhmjninZ2qIfNzB+mUuBD/XiUU8QVvnnptTFejPGmZIB94rut3SbfrmjY3DF+oRa0hq hE0y6Yk82m3PHonDD9y64F3M/pSsaK5+ElahBuQKYr1OmDTtVJH0iLodw/QHDb9WJkck Bt7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CnniiSWxY3paOgDOvI1YCAZukBWlLSLf+XLT17roP6I=; b=VfMGQTZwNyLZGAz4aLVLzajS8mA/nF2c75czENL4vYfEE09Gx9x5RoQmQmqvfGmtAq FyCDvLCT3crpK1xHDK3VdBN2uDmgjlAStzN5KegUVj7zJTa4tI6gcI/E844nIZBpZ3Su f4Jon4MrbWUAfBr7TpagzUqP2Qo6YslAgtxBpcJ/OQqYiY9F4fEpSS1vTgaq2H/1RmYg dn/VmWkehARyovKit7ZMmj8TmBWfCMFlXbD33Wzo/oY1bbhkcpnHrj9qif7bf0m01T9F wzStFCtaqFCF9B7vd+5Zu0ENraw15WS3o52NSSzJxopGjGzl066lxTdOM1lPwH1Op+Mr 9bSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id j34-v6si3121986edd.367.2018.07.18.06.36.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 06:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D25B8AD86; Wed, 18 Jul 2018 13:36:28 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Roman Gushchin , Michal Hocko , Johannes Weiner , Christoph Lameter , David Rientjes , Joonsoo Kim , Mel Gorman , Matthew Wilcox , Vlastimil Babka Subject: [PATCH v3 3/7] mm, slab: allocate off-slab freelists as reclaimable when appropriate Date: Wed, 18 Jul 2018 15:36:16 +0200 Message-Id: <20180718133620.6205-4-vbabka@suse.cz> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718133620.6205-1-vbabka@suse.cz> References: <20180718133620.6205-1-vbabka@suse.cz> 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: X-Virus-Scanned: ClamAV using ClamSMTP In SLAB, OFF_SLAB caches allocate management structures (currently just the freelist) from kmalloc caches when placement in a slab page together with objects would lead to suboptimal memory usage. For SLAB_RECLAIM_ACCOUNT caches, we can allocate the freelists from the newly introduced reclaimable kmalloc caches, because shrinking the OFF_SLAB cache will in general result to freeing of the freelists as well. This should improve accounting and anti-fragmentation a bit. Signed-off-by: Vlastimil Babka Acked-by: Christoph Lameter --- mm/slab.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/slab.c b/mm/slab.c index 9515798f37b2..99d779ba2b92 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2140,8 +2140,13 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags) #endif if (OFF_SLAB(cachep)) { + /* + * If this cache is reclaimable, allocate also freelists from + * a reclaimable kmalloc cache. + */ cachep->freelist_cache = - kmalloc_slab(cachep->freelist_size, 0u); + kmalloc_slab(cachep->freelist_size, + cachep->allocflags & __GFP_RECLAIMABLE); } err = setup_cpu_cache(cachep, gfp);