Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp7286835pxv; Fri, 30 Jul 2021 14:55:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3YFkKZk7ts0/tIFeLb/h2i3QhbTUG9zCMeXejdBW0I/CdrFbFwPFjnTe//k5eTmQrwntT X-Received: by 2002:a50:fb93:: with SMTP id e19mr2267403edq.347.1627682125316; Fri, 30 Jul 2021 14:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627682125; cv=none; d=google.com; s=arc-20160816; b=RuZoYP4Be1epoLiJO+iYxHXt3woripPyFaTy294ELv4UEoOYAWuYaJ2YShqOTB/Mvl fs5owZ2LRnV3qnOrjN+RLDanOoSkSm70ZkUqSEmVO1mUALFl34ZdGV6y/NrRxvjUgC5s bQe7+Ap0tO8h9qlf8UZyFAC2RmD8KgTpeKHg+JtL7Q9g+1Wge0m66elIyJvDcMXndXd/ vMr9Rpr3wOd/Cxha5XRDA2CTzaxEXIsP8p6FsrHwpgrPY/YXqBVLhQs9Eupbxcw3/bTa S+qa3h6J8OBxRkQK6yoq5m+KixdPzF0rZz/4nKpnAcY6cSml/iMGSXBW2nIZJHSYM0vD fMSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ALuer+FidfIoua3TUSD8gX2hS4i01XLeemyyVEmMoQc=; b=T2FSmhMHLNRCktIORizRQJ0jMe8qmIJDDnzv1VRjCUeHKVxCV3661LprA7LuqdgP4I BeE0qJAULT5F2CPdiQSgg29sYtLZcGt/udp5LbFuL02ZxHr8bKbxLuJ7GT1ArBqeNi2M CZ4NmhpgHR2lDgrZfYtsa7+lWq0dX70GVCBcZDzJa8Jjvv9zpbibVzy/1cFuKmvBG0pP VFt5X68zFl/T0VBgCf3/0KtY/SASm5jC3OS4YlssxQgisBTnjr7g3FC+L3gDtOclo4T4 CININa934kuc4sI1S3ATZML0DB7H7fTR7McLgQWuxcImECTOH4fPOFJw0CGqr2Vx6pTQ xGUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mqVuNenW; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f23si2955673edv.244.2021.07.30.14.55.01; Fri, 30 Jul 2021 14:55:25 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=mqVuNenW; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230430AbhG3VvS (ORCPT + 99 others); Fri, 30 Jul 2021 17:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbhG3VvR (ORCPT ); Fri, 30 Jul 2021 17:51:17 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2761DC06175F; Fri, 30 Jul 2021 14:51:12 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id nd39so19298211ejc.5; Fri, 30 Jul 2021 14:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ALuer+FidfIoua3TUSD8gX2hS4i01XLeemyyVEmMoQc=; b=mqVuNenWLGsGEestEyn1VFsrzeMOzP2lqyROg7AXmeoUVCaf6TFWK0BzzfuDLeM8zF jrmLd/hIp0m+ic8y82kCwAN0lqF4BBb2R0/TfRuZAMIj75G3qjAMcNI/bmIg3r+iEPAA zvlmNMBIbCR9gdYmAXk6vjnxw1Qc7zKeYuh+ou6PBz3PX+ICXhcc6+qSBDL10VuMZoMv gO3hy/DQALNsneH7xBudPFMdVe9/kKHac5rsioR4L9rqOdjI/yqHZWh/kci6xACpbJZ7 Oo5wYVhKkHGi6U3QOU2L3BWo8w2xFyhzX3/Vs+5Z/QywaGRQ/qTIwDX6tFPufDV2UvHe Jo8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ALuer+FidfIoua3TUSD8gX2hS4i01XLeemyyVEmMoQc=; b=WXckuOeVbUU0c/Uxmtaby0Jj1Xenjfmzc1NsDUXTDdCpepuI9nBElnc45X23J7nkGV 4B5rnj7E3APvASn84BARp6fUnsnt/RDVokwhNdErKen0NCdREItEaCHiZss4w7VJeb/r B41+Ypu/OyJiYIWZTzSUUJfYgUXjA7NZSmWDpEqDS6YwHqoVAE0RcSnpAcLrkoyoiKBP GYiRgq7l4/9I3J3lVu7m5Lrt99Ot3dTz0phwnjGIumEbBaW8k3cSbCopxWO1rDbSxx6r T+sO3WLdVF1tw97p9TCBYiM6Y2DwhAaJzFUe3kx+PL5gFBjKC5tDzz5A6fikCXOyMvT7 xwyg== X-Gm-Message-State: AOAM5318rp/ej8NAg1t64A+2dubB868JqnqLPwAJfUKH8ZpyxuZbwQcT uZtQSYlAEPeAsxAFuUUPMzzlTn7RaAMVX5VsX2o= X-Received: by 2002:a17:906:fc0b:: with SMTP id ov11mr1436950ejb.238.1627681870825; Fri, 30 Jul 2021 14:51:10 -0700 (PDT) MIME-Version: 1.0 References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> <42353193-6896-aa85-9127-78881d5fef66@google.com> In-Reply-To: <42353193-6896-aa85-9127-78881d5fef66@google.com> From: Yang Shi Date: Fri, 30 Jul 2021 14:50:58 -0700 Message-ID: Subject: Re: [PATCH 03/16] huge tmpfs: remove shrinklist addition from shmem_setattr() To: Hugh Dickins Cc: Andrew Morton , Shakeel Butt , "Kirill A. Shutemov" , Miaohe Lin , Mike Kravetz , Michal Hocko , Rik van Riel , Christoph Hellwig , Matthew Wilcox , "Eric W. Biederman" , Alexey Gladkov , Chris Wilson , Matthew Auld , Linux FS-devel Mailing List , Linux Kernel Mailing List , linux-api@vger.kernel.org, Linux MM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 30, 2021 at 12:31 AM Hugh Dickins wrote: > > There's a block of code in shmem_setattr() to add the inode to > shmem_unused_huge_shrink()'s shrinklist when lowering i_size: it dates > from before 5.7 changed truncation to do split_huge_page() for itself, > and should have been removed at that time. > > I am over-stating that: split_huge_page() can fail (notably if there's > an extra reference to the page at that time), so there might be value in > retrying. But there were already retries as truncation worked through > the tails, and this addition risks repeating unsuccessful retries > indefinitely: I'd rather remove it now, and work on reducing the > chance of split_huge_page() failures separately, if we need to. Yes, agreed. Reviewed-by: Yang Shi > > Fixes: 71725ed10c40 ("mm: huge tmpfs: try to split_huge_page() when punching hole") > Signed-off-by: Hugh Dickins > --- > mm/shmem.c | 19 ------------------- > 1 file changed, 19 deletions(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index 24c9da6b41c2..ce3ccaac54d6 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -1061,7 +1061,6 @@ static int shmem_setattr(struct user_namespace *mnt_userns, > { > struct inode *inode = d_inode(dentry); > struct shmem_inode_info *info = SHMEM_I(inode); > - struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); > int error; > > error = setattr_prepare(&init_user_ns, dentry, attr); > @@ -1097,24 +1096,6 @@ static int shmem_setattr(struct user_namespace *mnt_userns, > if (oldsize > holebegin) > unmap_mapping_range(inode->i_mapping, > holebegin, 0, 1); > - > - /* > - * Part of the huge page can be beyond i_size: subject > - * to shrink under memory pressure. > - */ > - if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { > - spin_lock(&sbinfo->shrinklist_lock); > - /* > - * _careful to defend against unlocked access to > - * ->shrink_list in shmem_unused_huge_shrink() > - */ > - if (list_empty_careful(&info->shrinklist)) { > - list_add_tail(&info->shrinklist, > - &sbinfo->shrinklist); > - sbinfo->shrinklist_len++; > - } > - spin_unlock(&sbinfo->shrinklist_lock); > - } > } > } > > -- > 2.26.2 >