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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 2AF1DC33CB1 for ; Tue, 14 Jan 2020 10:31:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D97CA207FF for ; Tue, 14 Jan 2020 10:31:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="CWwvQIMa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D97CA207FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5BF868E0005; Tue, 14 Jan 2020 05:31:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 549F28E0003; Tue, 14 Jan 2020 05:31:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 438198E0005; Tue, 14 Jan 2020 05:31:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 2D8B88E0003 for ; Tue, 14 Jan 2020 05:31:13 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id CE79A2495 for ; Tue, 14 Jan 2020 10:31:12 +0000 (UTC) X-FDA: 76375872384.04.act37_7eeccb3afd32e X-HE-Tag: act37_7eeccb3afd32e X-Filterd-Recvd-Size: 4748 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 10:31:12 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id w1so13726606ljh.5 for ; Tue, 14 Jan 2020 02:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gH2onGwJqIgSVIVO9iF6x/48+kAkgINLPogWn+IxdXo=; b=CWwvQIMaFeGbGcccImhlvs+GWFEMa+s41DfLTdi1dEYXmM/c9ttvKpEVFZ3dqVHpAZ J1ZSto4Ma/A2rGpMzgBYWcSOtodiUWd8S/F3Qs5FtRli34jgB7d8FirhpsFA09NtKmiL 7wggFVGtiFPUYJIFhzWaKeeGtyqMEDkyRMWSqSJBQzTt3IG/infOvP9BWGKVH9rGn/k0 yXN0lMiLBlXfnNRVSj6EykH/yYhTGG3+qiiJ7+LK9ocNN9jYW+lId5t9wGBLib03Lyv/ J4G7pK3IEIDviBleMQLqtKlxPxv0OcSo4pVcwadkegBN/Uwrg3xsYNLaBTHmyFqcX+uh ut3Q== 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gH2onGwJqIgSVIVO9iF6x/48+kAkgINLPogWn+IxdXo=; b=Dop1IFjrgDfLv2xNwJ14VIfs7V9bJYMs2DA1t2akAGH0GHoaYNyhuJbqiij8YPFG1f 6J5bjNHR22VyShCBovHxaEFqnI4+pLmdCLpzwQXQpHTmTv/MMphnMHcx91nsHYHueKOG XUQn0aKRyiK0Ycf5KN6IBzKl66A6G+u4XcSR8DCtwvm7lZA2V9uSL69Iy8N8keS1fMBt L+LS6PElPDGuo1xeUV6LlKJqhDx3ZHCbx9MX7l2Gc38aIwrEZoT6HITy7nvPY1N9h3rd JH2YW0LzkEG2HRf+bMTyo0twB9kPS5FHBeQfjJEEwpyQxJaVgmAKNBTPcnjrwu3y3Eny 1/Qg== X-Gm-Message-State: APjAAAWs9E9VPUwtPuETlNoLHSfLMXA7YdRKXcJETdqC3vLiM1ORgaWb k0rWq/nT5GizVVZZb5NSOau0kg== X-Google-Smtp-Source: APXvYqysJMZ2wctkZa481wCr4cDEEoTAjvmfbiYs1X+0OFb3uAQSoP+nU4jvncbrrWPLPosgB3gMvQ== X-Received: by 2002:a2e:b010:: with SMTP id y16mr13956962ljk.238.1578997870606; Tue, 14 Jan 2020 02:31:10 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id c189sm7081166lfg.75.2020.01.14.02.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 02:31:09 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id A0F64100823; Tue, 14 Jan 2020 13:31:12 +0300 (+03) Date: Tue, 14 Jan 2020 13:31:12 +0300 From: "Kirill A. Shutemov" To: Michal Hocko Cc: 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, rientjes@google.com Subject: Re: [Patch v2] mm: thp: grab the lock before manipulation defer list Message-ID: <20200114103112.o6ozdbkfnzdsc2ke@box> References: <20200109143054.13203-1-richardw.yang@linux.intel.com> <20200111000352.efy6krudecpshezh@box> <20200114093122.GH19428@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200114093122.GH19428@dhcp22.suse.cz> User-Agent: NeoMutt/20180716 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, Jan 14, 2020 at 10:31:22AM +0100, Michal Hocko wrote: > On Sat 11-01-20 03:03:52, Kirill A. Shutemov wrote: > > On Thu, Jan 09, 2020 at 10:30:54PM +0800, Wei Yang wrote: > > > As all the other places, we grab the lock before manipulate the defer list. > > > Current implementation may face a race condition. > > > > > > For example, the potential race would be: > > > > > > CPU1 CPU2 > > > mem_cgroup_move_account split_huge_page_to_list > > > !list_empty > > > lock > > > !list_empty > > > list_del > > > unlock > > > lock > > > # !list_empty might not hold anymore > > > list_del_init > > > unlock > > > > I don't think this particular race is possible. Both parties take page > > lock before messing with deferred queue, but anytway: > > > > Acked-by: Kirill A. Shutemov > > I am confused, if the above race is not possible then what would be a > real race? We really do not want to have a patch with a misleading > changelog, do we? The alternative is to make sure that all page_deferred_list() called with page lock taken. I'll look into it. -- Kirill A. Shutemov