From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D30C33CB3 for ; Wed, 15 Jan 2020 03:26:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1C6C2467A for ; Wed, 15 Jan 2020 03:26:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bpGcNk0K" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1C6C2467A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 535A38E0005; Tue, 14 Jan 2020 22:26:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E6D68E0003; Tue, 14 Jan 2020 22:26:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AE1B8E0005; Tue, 14 Jan 2020 22:26:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id 24CA78E0003 for ; Tue, 14 Jan 2020 22:26:58 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id CEDC8180AD81F for ; Wed, 15 Jan 2020 03:26:57 +0000 (UTC) X-FDA: 76378432074.30.fight72_76f34d689ba11 X-HE-Tag: fight72_76f34d689ba11 X-Filterd-Recvd-Size: 4652 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jan 2020 03:26:57 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id a6so6781518pjh.2 for ; Tue, 14 Jan 2020 19:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Iae/mJgVCLpfLGSuYynupuWE+Z4MahohKNOA3VuWzvQ=; b=bpGcNk0KuEcv+Ht10XLkBn/HP68yrADkbQzthX19bcUJf/xKxwL4QilvYOrq63iLtP QXHGouASBxogJp3LM3yUP91HjYlur9dWJbk1ZdvMkGziZgmXfsEb4avARPSYrYz4rAi2 OvLl6gWqyFfYMDOctvwF2bIE93PVsy8D7diUVOYObx1xhI1j8NNS0J3jP1ta1FEOYUhN fJkqV4C0RQGqlxMN8DMVvJKf7dAkzkAKKtQ1NBTJvxMf445Hmw2mTio4MwQ4BCYmKke0 akfN3Qikj18K8eS4W8yDU5sAvOYFxPTnfoLGu4VRBE1cm/xaJ5NtSGJk5PobXwkuqimc oTRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Iae/mJgVCLpfLGSuYynupuWE+Z4MahohKNOA3VuWzvQ=; b=QHAv4v7SASGsVuMgKw/Vr4pDfbgejltJZlbiB7KzWpX5zJCpmZ3VytoJZn54rv1ZZc DZajVzonCk5kdDS34Wi/h+4MyN8U7rnV40JN6IGt+tnvKPaqC/T7fKSkiYD6pZni1bH/ zFcRKP7ZhlmNeeI9HFTUM1dvVH+pRkEoq/LblL6fMJKO0qOCGp+nag624jmVNAgylUdB Io9f6X73Ymvn5xuyniaWQyZ4etZiwdXA1fomjv9OzBK5L62QI2mXrvA4t0vDrg9w0lMl gN5SZiWrlTw58XuF7sIb99XcNcASfkQVSxgmcr9nKFjl+/wolA1Gys3eFzToINtQKk+y SRsw== X-Gm-Message-State: APjAAAX8iMHCRtT59IrOGF007N36xl0Hhbuvhi+SzL43sI1NWaLLMNnv 1TG7Q/311371m6XfhJHUzkbA4A== X-Google-Smtp-Source: APXvYqwymAKsgPxc8cksJon02QT8iWkblHOgN2DfaxP7yMktruZkpOMfqWcYVlLtqQMUC1ww0gHogA== X-Received: by 2002:a17:902:7e49:: with SMTP id a9mr22409863pln.230.1579058815911; Tue, 14 Jan 2020 19:26:55 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id a6sm18050644pgg.25.2020.01.14.19.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 19:26:54 -0800 (PST) Date: Tue, 14 Jan 2020 19:26:53 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Wei Yang cc: "Kirill A. Shutemov" , Michal Hocko , hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, yang.shi@linux.alibaba.com, alexander.duyck@gmail.com Subject: Re: [Patch v2] mm: thp: grab the lock before manipulation defer list In-Reply-To: <20200115010722.GA4916@richard> Message-ID: References: <20200109143054.13203-1-richardw.yang@linux.intel.com> <20200111000352.efy6krudecpshezh@box> <20200114093122.GH19428@dhcp22.suse.cz> <20200114103112.o6ozdbkfnzdsc2ke@box> <20200114105921.eo2vdwikrvtt3gkb@box> <20200115010722.GA4916@richard> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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: On Wed, 15 Jan 2020, Wei Yang wrote: > >split_huge_page_to_list() has page lock taken. > > > >free_transhuge_page() is in the free path and doesn't susceptible to the > >race. > > > >deferred_split_scan() is trickier. list_move() should be safe against > >list_empty() as it will not produce false-positive list_empty(). > >list_del_init() *should* (correct me if I'm wrong) be safe because the page > >is freeing and memcg will not touch the page anymore. > > > >deferred_split_huge_page() is a problematic one. It called from > >page_remove_rmap() path witch does require page lock. I don't see any > >obvious way to exclude race with mem_cgroup_move_account() here. > >Anybody else? > > If my understanding is correct, the reason is deferred_split_huge_page() > doesn't has page lock taken, right? > I think the fix that you have proposed has inspired some deeper looks at the locking around the deferred split queue and the hope was that perhaps this could be protected by the page lock but it was found that at least in one path that isn't taken. So I believe your fix is still needed and any possible optimizations in this area can be proposed on top.