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 12A3BC33C9E for ; Tue, 14 Jan 2020 20:57:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BAB7524658 for ; Tue, 14 Jan 2020 20:57:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="meEWzXz0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAB7524658 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 34D3B8E0005; Tue, 14 Jan 2020 15:57:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FD328E0003; Tue, 14 Jan 2020 15:57:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2135E8E0005; Tue, 14 Jan 2020 15:57:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id 0C0AE8E0003 for ; Tue, 14 Jan 2020 15:57:26 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id AA477180AD838 for ; Tue, 14 Jan 2020 20:57:25 +0000 (UTC) X-FDA: 76377450450.10.cough39_40c94fbacee06 X-HE-Tag: cough39_40c94fbacee06 X-Filterd-Recvd-Size: 4628 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 20:57:25 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id l35so6422165pje.3 for ; Tue, 14 Jan 2020 12:57:25 -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=Yw4+mImP3xYemjNvEkTXmDMcGpXxaxAKM4GUBoCUQVE=; b=meEWzXz0iIiGD+szilzJbFn93Ka67aSbLRJ9wne3w2YWA+jsC7qemaDkmGSUrhndjx 6LzOtL6Vvux8f8xKsXQz0p5sHQTf7/Z14qIDx7ZCfiRZLg11JY86JF48ZSFoSYisTPgD Z3hyNfR+nHSLcmiWbGyA1E0X3mCdGHa1iLNwBOIXcLHS1cEhv5502Gjcp/H3L4bYi5VM EhWQLy65l4h/wnaGDxqWu+Ve/UMFwaq3Cx79sI7wDGUNcwpMuwUnuJFvI5Z7bewxIlR9 7Ol2MY1JtdE0ZkhBTpaPEv+yR8x1MNHBaqg+G2fPLK1WiBBZ2VGvkUhAq2WVsHpdcF7A JonQ== 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=Yw4+mImP3xYemjNvEkTXmDMcGpXxaxAKM4GUBoCUQVE=; b=A7jjgXmOZ8c3ojpN1imEJRsh9adKQZEMQfJgDHC1nhj6FQraK7GTA7mTBvdzLzXIsh 2mhSNWTvkaZq6YIsd6CwVGFrJAhuzmBU4ORtB+7U4+ro3TSZG0RBFTjt+eLkktrprTXa PuDe2xEp7Y/bua8GaJW1YhMyjQxKuzUD5RNt3IBCUrBGtDD8Iv4tWEVs/PlOpD8L1Td8 wtIw3ZKiQ2fgHsJnZd5PGTlIUhcecV+wquT6FX/rT0Bg4RYqS7ATzUuGChuK6Q4p53to ljheVv9mPCbfP9FoqezPHbtSzrDv4h3omzLPcXYLCrPVilM9nrUarVVgwPwTI9E33CkB iPKQ== X-Gm-Message-State: APjAAAXuMLAXjFQ9R7raEJKkJoRBgPNzLtD2VhSjUW6g/A+t1Oh2xjVa WQ7VcwJMVIapau+7Pr+cOyeZQQ== X-Google-Smtp-Source: APXvYqz7YJQ9CTCHO6hNIZZYM+ZTeUZfAdGByWSmm119Y5+Eq0RdJ4hmTUZWY3fJDjxiiqFGyvET8A== X-Received: by 2002:a17:90a:868b:: with SMTP id p11mr31206212pjn.60.1579035443905; Tue, 14 Jan 2020 12:57:23 -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 t63sm19315754pfb.70.2020.01.14.12.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 12:57:22 -0800 (PST) Date: Tue, 14 Jan 2020 12:57:22 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: "Kirill A. Shutemov" cc: Michal Hocko , Wei Yang , 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: <20200114105921.eo2vdwikrvtt3gkb@box> 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> 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 Tue, 14 Jan 2020, Kirill A. Shutemov 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? > > Wei, could you rewrite the commit message with deferred_split_huge_page() > as a race source instead of split_huge_page_to_list()? > I think describing the race in terms of deferred_split_huge_page() makes the most sense and I'd prefer a cc to stable for 5.4+. Even getting the split_queue_len, which is unsigned long, to underflow because of a list_empty(page_deferred_list()) check that is no longer accurate after the lock is taken would be a significant issue for shrinkers.