Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp630641ybl; Fri, 23 Aug 2019 06:12:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk0IS2JXyk02IPtQrzGwSqf7VESvYz9wsTA1p6hhRdijhYqU2B4zMkUFQG9Y6x5URvJ0yN X-Received: by 2002:a63:4823:: with SMTP id v35mr3961093pga.138.1566565936249; Fri, 23 Aug 2019 06:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566565936; cv=none; d=google.com; s=arc-20160816; b=C1zY8wD0ATd1cVtYW7HQ1EnNpZTmAgvP/cVlmASVmmjBACuOP21HOY0RNBhQ1hhcLL zQlGGLosuiaHDLKTv7vW6I/8fYzonsZHbOGxcH+ERyb2o/AgI3pjxzUQWYn/AEGvPaTR 0WExlFdALyGeb1O65VJmqsZYMx8CnPAFp4IH+vGIdNPyzNUeSO69hTbqK5o7Z89IEcKn cEIEz9XwKZPG8d7zfNXCq0OJ0bRoCC+EJbXKUwVVx69e35Y0lR9A7oNTxXsN2Uy2y7Nb 6NInnApvECUMXahpZ9OCx7y9pwk+y6up2s2kYaGNAMWaWmmW4pstAj6BcqNzDEhsDo/6 CFeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=q2xEM4ZZIH60IhHUp/Tsrc3BwYRYS3HENwO9UK8ZY8A=; b=y+9kgPojoMUoEzc/XFG4X/vyFWEzLKQfPvZxV2UGRy98V1M6THN+3FIW0uA1qL9j2O UZypwfO2e80sRZbeGO8z0LXCdbStiNoey8c1eCoSavpFEjoCQON/vUFaTF82qlm4wv1Y AhBNNG2g5soiY7akA1oeazi4V7E/6kPEWGedLxD9wlfYh1UErcmQ0P0TtvU1jDYrYWst N6WgKBbHwj1M7KXgaODbkDGCmHMjDOo372IVKLJTkDpJQ0Dk8LOT9Copd5lueeojr3G0 w1+xAGXekI2oPgLF5KqMmO2swWZ/97wGXENGeCC7UZlBINg49LzJWy49EWda5bszIC4H prdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sr9LjJuS; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si2653713pfj.128.2019.08.23.06.11.59; Fri, 23 Aug 2019 06:12:16 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=sr9LjJuS; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388971AbfHVUAh (ORCPT + 99 others); Thu, 22 Aug 2019 16:00:37 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:49091 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733297AbfHVUAg (ORCPT ); Thu, 22 Aug 2019 16:00:36 -0400 Received: by mail-vk1-f201.google.com with SMTP id l3so2754565vkb.15 for ; Thu, 22 Aug 2019 13:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=q2xEM4ZZIH60IhHUp/Tsrc3BwYRYS3HENwO9UK8ZY8A=; b=sr9LjJuS+htHRlolM9YkWocHcNmySO3oWOJUlCW5vIRDBoMd6wQCLTBGuwEuqsC2Ur Wma8aSSiAtzW0x3pzUQrZAkO2xN5hc6iK2purEAarL8Pn57u85rUGnZ4Z5Kb5c6wmko8 osjWvJYlNjDc82qCar5zR3/Yiffmj2juupyRjK82d70b2Vtm5UKfkHcqRuxyUwoL08nl yMNbpjqkol5SNc04oi+ZOGu7nXeE9PZd/JN5LU+cmK/4JYzpGnfGv8H3JvOEfXDlFveS l96DKLspK6+yW+KbyQCD+rP6J3xGnoD3UDJzgmrdUG2SbU8ICA3jNFDo6aBuqAtGrAVo OBPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=q2xEM4ZZIH60IhHUp/Tsrc3BwYRYS3HENwO9UK8ZY8A=; b=L+F+dKgdyr1Bho6VAXTjaZ66XeuXdKFpHSo2GMapAK/yH07FEWVc7qnf2UsrJvSRCt O8Um5udK44NOvpoOc3wQmQv5TG3jWKcQDBu32EN9Q3/gZ0DMAj4K6m0kk2FQX3iFw+kI fCC2a/Xx6aI7EM2y4xx1MmB3IjdwcmQqRl7Uw3ZDyTDvkMEhWKA2SO8uXt1pjEAcFKeO 53LUER5+jLFTEhWaEdOAghP5zUF1+GOYtjLcFyxEFwthQzJa9ySqKhsnNOVSa2kQwiLk GZVgzqzoiDMHOWFzlHOBR3eE8/eYr4lRqZ/IOtWj8kUymCTMcu7Y+ORq2Qn5F+3KCvZh E8Ug== X-Gm-Message-State: APjAAAUn3s6w72IXeupd0cp5WS6B7K+UPav0RGtVGl0c1XMi0uY4PtvC MNlClGl/TKoVaWx/C2IwZlGQfE5UCd0= X-Received: by 2002:a67:fb90:: with SMTP id n16mr560113vsr.7.1566504034917; Thu, 22 Aug 2019 13:00:34 -0700 (PDT) Date: Thu, 22 Aug 2019 13:00:28 -0700 Message-Id: <20190822200030.141272-1-khazhy@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog Subject: [PATCH v2 1/3] fuse: on 64-bit store time in d_fsdata directly From: Khazhismel Kumykov To: miklos@szeredi.hu Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, shakeelb@google.com, Khazhismel Kumykov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implements the optimization noted in f75fdf22b0a8 ("fuse: don't use ->d_time"), as the additional memory can be significant. (In particular, on SLAB configurations this 8-byte alloc becomes 32 bytes). Per-dentry, this can consume significant memory. Reviewed-by: Shakeel Butt Signed-off-by: Khazhismel Kumykov --- fs/fuse/dir.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index dd0f64f7bc06..f9c59a296568 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -24,6 +24,18 @@ static void fuse_advise_use_readdirplus(struct inode *dir) set_bit(FUSE_I_ADVISE_RDPLUS, &fi->state); } +#if BITS_PER_LONG >= 64 +static inline void fuse_dentry_settime(struct dentry *entry, u64 time) +{ + entry->d_fsdata = (void *) time; +} + +static inline u64 fuse_dentry_time(struct dentry *entry) +{ + return (u64)entry->d_fsdata; +} + +#else union fuse_dentry { u64 time; struct rcu_head rcu; @@ -38,6 +50,7 @@ static inline u64 fuse_dentry_time(struct dentry *entry) { return ((union fuse_dentry *) entry->d_fsdata)->time; } +#endif /* * FUSE caches dentries and attributes with separate timeout. The @@ -242,6 +255,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) goto out; } +#if BITS_PER_LONG < 64 static int fuse_dentry_init(struct dentry *dentry) { dentry->d_fsdata = kzalloc(sizeof(union fuse_dentry), GFP_KERNEL); @@ -254,16 +268,21 @@ static void fuse_dentry_release(struct dentry *dentry) kfree_rcu(fd, rcu); } +#endif const struct dentry_operations fuse_dentry_operations = { .d_revalidate = fuse_dentry_revalidate, +#if BITS_PER_LONG < 64 .d_init = fuse_dentry_init, .d_release = fuse_dentry_release, +#endif }; const struct dentry_operations fuse_root_dentry_operations = { +#if BITS_PER_LONG < 64 .d_init = fuse_dentry_init, .d_release = fuse_dentry_release, +#endif }; int fuse_valid_type(int m) -- 2.23.0.187.g17f5b7556c-goog