Received: by 10.192.165.156 with SMTP id m28csp760079imm; Fri, 13 Apr 2018 07:23:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4807EZdzecrMkkvpSBqrrJpkjKiPab8odwYA3e2EKN7jtKYzMJBTb8fzCSSz19jUkX2RufZ X-Received: by 10.99.143.69 with SMTP id r5mr4274311pgn.159.1523629400952; Fri, 13 Apr 2018 07:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523629400; cv=none; d=google.com; s=arc-20160816; b=imOnj9I4HPN9QnSeSuLyyM0APSv/4mk5g1rgTH3cLZSYHApbPUYak8cmpghYoisUeO TMeE3NJ/8XxtEZhTg/cVpU5yjb7e/Q5lrBtHDrc5rbrwMi6TEgPj/vvlCXJOkXJ+3nw2 KWoA7SDrp1CD+R8dzW5CsfTXQoU9wY2CxPazbJAUnEeGXn3Jpe7US/6OkAaUWpDyXQLH w7hECJnZ47AV0NoqxPbqJJqk8uzQdoRp4vuCbr3fdz1yf2NR0P1Q7Fot+w/SEP62kG6G rklRtpml7a0boY77GR9fHS/BEtsHObgrKKuv7ZSZMbgVqXRDtb/QBOIGfJcSg/Nke9ZQ a8mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=4osJ5UYfvUxclVb3nYULLzrRQIK6o76OWOWg1v/tx7g=; b=ShopmnzYLCjzVrZ/HqnnOd8zd96Fmkm3AP7avFM712B75hdMMIsLlsR8XKttW10y+s o89IPs4KGgJnizSmvR8bTK6t9mHy1CWyWbsaMQACfOkPgVRwIn74XKdWrgv9wrzgw/IT I7FViOHVO6pCM0TB5ff4SPnJdLoxA9kF+aH0/em9iYpTqB1qGAPmTvoyHoxv1f1dZh55 0SNW34982rYddGaK/zYtQpPThMi3LL67Uvat5y7lgtZm8c88A/rU9S5FXwsGHbIvgyQo 8u//eTeAltJ8FwAOUbhjGY6jYKOA0RlLR1PBf+ckp2z/Y9n684sMGMxt5ZXt7imeOoYB POEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si5568605pld.130.2018.04.13.07.23.06; Fri, 13 Apr 2018 07:23:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754632AbeDMOWB (ORCPT + 99 others); Fri, 13 Apr 2018 10:22:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:54880 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbeDMOWA (ORCPT ); Fri, 13 Apr 2018 10:22:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7B6C2AEDA; Fri, 13 Apr 2018 14:21:58 +0000 (UTC) Subject: Re: [PATCH 3/3] dcache: account external names as indirectly reclaimable memory To: Michal Hocko , Minchan Kim Cc: Roman Gushchin , linux-mm@kvack.org, Andrew Morton , Alexander Viro , Johannes Weiner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20180305133743.12746-1-guro@fb.com> <20180305133743.12746-5-guro@fb.com> <20180413133519.GA213834@rodete-laptop-imager.corp.google.com> <20180413135923.GT17484@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: <13f1f5b5-f3f8-956c-145a-4641fb996048@suse.cz> Date: Fri, 13 Apr 2018 16:20:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180413135923.GT17484@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/13/2018 03:59 PM, Michal Hocko wrote: > On Fri 13-04-18 22:35:19, Minchan Kim wrote: >> On Mon, Mar 05, 2018 at 01:37:43PM +0000, Roman Gushchin wrote: > [...] >>> @@ -1614,9 +1623,11 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) >>> name = &slash_name; >>> dname = dentry->d_iname; >>> } else if (name->len > DNAME_INLINE_LEN-1) { >>> - size_t size = offsetof(struct external_name, name[1]); >>> - struct external_name *p = kmalloc(size + name->len, >>> - GFP_KERNEL_ACCOUNT); >>> + struct external_name *p; >>> + >>> + reclaimable = offsetof(struct external_name, name[1]) + >>> + name->len; >>> + p = kmalloc(reclaimable, GFP_KERNEL_ACCOUNT); >> >> Can't we use kmem_cache_alloc with own cache created with SLAB_RECLAIM_ACCOUNT >> if they are reclaimable? > > No, because names have different sizes and so we would basically have to > duplicate many caches. We would need kmalloc-reclaimable-X variants. It could be worth it, especially if we find more similar usages. I suspect they would be more useful than the existing dma-kmalloc-X :) Maybe create both (dma and reclaimable) on demand?