From patchwork Tue May 15 00:27:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 10399677 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 2C32B601C8 for ; Tue, 15 May 2018 00:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D62A228595 for ; Tue, 15 May 2018 00:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8528285A7; Tue, 15 May 2018 00:28:00 +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 1714F28595 for ; Tue, 15 May 2018 00:27:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 381726B0006; Mon, 14 May 2018 20:27:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3306A6B0008; Mon, 14 May 2018 20:27:57 -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 2465B6B000A; Mon, 14 May 2018 20:27:57 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it0-f70.google.com (mail-it0-f70.google.com [209.85.214.70]) by kanga.kvack.org (Postfix) with ESMTP id F1A9E6B0006 for ; Mon, 14 May 2018 20:27:56 -0400 (EDT) Received: by mail-it0-f70.google.com with SMTP id s201-v6so16779120ita.1 for ; Mon, 14 May 2018 17:27:56 -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:message-id :subject:from:to:cc:mime-version:date:references:in-reply-to :content-transfer-encoding; bh=S0B7zdUvTkVGACCvYz7gDTXfXVwdV8AJfBm60eHLB2Q=; b=Ccw3J+weKqzwI4e9j6+ACF/sZpF0zW6w3n494TPaJ0vPyNhDql7dUXB+1W9LNzzroG hA6ULaOLWmswnUGgChLOy9PToH2SyBgtAhxr/QmAhK6bAycL7wp0JdzzvTJn5rJxm57S vajrFlaP2Y712vzrB8FIOks5jSKyMxkz+ytvs9WMbGQzFFZjP9bAjDX162ddIwvkujNJ Yq1VTawKzL3TPhu78raDJQTXfPzhOwyqojcxQUC2iTox6CqYfsRUmy7zCR+zSRRcoabw P8AUohQocBVQ6SuAIrIGgi5XltxLEbCVTZbwdehEs+aK0SrLIe6ds56EnMrjB5ksownZ 0aPw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp X-Gm-Message-State: ALKqPwepURAfYePyxltDaUDnVF2zRYT7ZqYlcxOW5W+9xn1sABee+VLc VeTH4GYgkvIARuWo7nuaWwpjfEtLWqaEGNBIUPTNpbxVHKZQJhG2kP0gxS7q7zaoMTFsePCZQpR FEA6mUYmHtT0Zd1HlYLJO8PT4yJI/sAfAGR+uKvSf/m6CeODwwkkNDvl+mJkI8tBE/g== X-Received: by 2002:a6b:8065:: with SMTP id b98-v6mr12389962iod.281.1526344061735; Mon, 14 May 2018 17:27:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq2Y/RHYoFDopZjgE7bMZ/wBzG6HEGnn7G5sxJKTTJmDLiZrHYrYuVCMt6yQy8z8a9YKVN7 X-Received: by 2002:a6b:8065:: with SMTP id b98-v6mr12389908iod.281.1526344060716; Mon, 14 May 2018 17:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526344060; cv=none; d=google.com; s=arc-20160816; b=s0HtyOSUS13LwItVhLWlmN2HpKkxGpCPihelT5WHJZ/vAPTXQHESEU218MB7P5S7QX VdeS8t4gA7aivFA5qHRjnt/FdYVsi270oYZ767iGMIEiEKg1yp8VLfwueioyQJ3WLg3M x84le3YFgeIku1YjO9TsDE60zwnWaRtpurQqDKa3Xski4kNuntI29h/tJIuoOfVuZGdT Z+2YouJfbNCgSyEk8LvqowLn5kcqJ38UzxLQqfqNEFomGnaVK/UnlRJ2sUwkd6X2txVl Vw4y8IlFd/SZ77SvsUzAmgtJnAqZhl6sL2T0Wy/q6o1Q1TqeDWlT4L7iEkBBcP6B0HbA M/8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:date:mime-version :cc:to:from:subject:message-id:arc-authentication-results; bh=S0B7zdUvTkVGACCvYz7gDTXfXVwdV8AJfBm60eHLB2Q=; b=Wa4lnpiKdwF2eSQn2MgBwcxZdwD8x/k9T3dR4IpXBymY3ofEOK7z/q+BN4SJkCN/IE bGvhPzg6fTqE+Mp2xSNMC8l61RcCLt3+aVFFDqS6H0cRMpvzSr91higxNfZoIApKD17g a8Nr+TGmwxKnn4KTjP0mYtN5a+CSdw6txASCKrXl0UCXbnbZZdFcPRoN4Pl2EVRgW3Wa JrjcORqU3PDLCXA33CJcjDaPSU+mlPQR2hv6eycefHRPmb+1j0EIROF0dV2d7pZUC04/ 2xtHP0BYBeGQSyjhE+xTn2RRzhzkuo9NUMuT0HfDINjutwYh8K6I4bGatOTSbqmh6w8C 1Q2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from www262.sakura.ne.jp (www262.sakura.ne.jp. [202.181.97.72]) by mx.google.com with ESMTPS id f207-v6si7643889itd.82.2018.05.14.17.27.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 May 2018 17:27:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) client-ip=202.181.97.72; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of penguin-kernel@i-love.sakura.ne.jp designates 202.181.97.72 as permitted sender) smtp.mailfrom=penguin-kernel@i-love.sakura.ne.jp Received: from fsav305.sakura.ne.jp (fsav305.sakura.ne.jp [153.120.85.136]) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w4F0RZZO055061; Tue, 15 May 2018 09:27:35 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav305.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp); Tue, 15 May 2018 09:27:35 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp) Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.14.5/8.14.5) with ESMTP id w4F0RZgx055057; Tue, 15 May 2018 09:27:35 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: (from i-love@localhost) by www262.sakura.ne.jp (8.14.5/8.14.5/Submit) id w4F0RZ27055056; Tue, 15 May 2018 09:27:35 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Message-Id: <201805150027.w4F0RZ27055056@www262.sakura.ne.jp> X-Authentication-Warning: www262.sakura.ne.jp: i-love set sender to penguin-kernel@i-love.sakura.ne.jp using -f Subject: Re: [PATCH] shmem: don't call =?ISO-2022-JP?B?cHV0X3N1cGVyKCkgd2hlbiBm?= =?ISO-2022-JP?B?aWxsX3N1cGVyKCkgZmFpbGVkLg==?= From: Tetsuo Handa To: Eric Biggers Cc: syzbot+d2586fde8fdcead3647f@syzkaller.appspotmail.com, viro@ZenIV.linux.org.uk, hughd@google.com, syzkaller-bugs@googlegroups.com, linux-mm@kvack.org, Dave Chinner MIME-Version: 1.0 Date: Tue, 15 May 2018 09:27:35 +0900 References: <20180514170423.GA252575@gmail.com> <20180514171154.GB252575@gmail.com> In-Reply-To: <20180514171154.GB252575@gmail.com> 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 Eric Biggers wrote: > > I'm not following, since generic_shutdown_super() only calls ->put_super() if > > ->s_root is set, which only happens at the end of shmem_fill_super(). Isn't the > > real problem that s_shrink is registered too early, causing super_cache_count() > > and shmem_unused_huge_count() to potentially run before shmem_fill_super() has > > completed? Or alternatively, the problem is that super_cache_count() doesn't > > check for SB_ACTIVE. > > > > Coincidentally, this is already going to be fixed by commit 79f546a696bff259 > ("fs: don't scan the inode cache before SB_BORN is set") in vfs/for-linus. > Just an idea, but if shrinker registration is too early, can't we postpone it like below? --- a/fs/super.c +++ b/fs/super.c @@ -521,7 +521,6 @@ struct super_block *sget_userns(struct file_system_type *type, hlist_add_head(&s->s_instances, &type->fs_supers); spin_unlock(&sb_lock); get_filesystem(type); - register_shrinker_prepared(&s->s_shrink); return s; } @@ -1287,6 +1286,7 @@ struct dentry * WARN((sb->s_maxbytes < 0), "%s set sb->s_maxbytes to " "negative value (%lld)\n", type->name, sb->s_maxbytes); + register_shrinker_prepared(&sb->s_shrink); up_write(&sb->s_umount); free_secdata(secdata); return root; --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -313,6 +313,7 @@ int prealloc_shrinker(struct shrinker *shrinker) shrinker->nr_deferred = kzalloc(size, GFP_KERNEL); if (!shrinker->nr_deferred) return -ENOMEM; + INIT_LIST_HEAD(&shrinker->list); return 0; }