Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4992985ybl; Tue, 14 Jan 2020 01:32:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwtuW2yJxvIBofzNXbwN6FPQ1De9Jbru7QD3URMHN+J/Ou+FVoZRhv4faZlYfueJSdCqcHK X-Received: by 2002:aca:db41:: with SMTP id s62mr15294566oig.87.1578994369212; Tue, 14 Jan 2020 01:32:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578994369; cv=none; d=google.com; s=arc-20160816; b=hxsJt1PBeqOgpzatBAi+LGUwhEoicXLfYB2wjalva/Zq8Tv1X/X8GGrPl+3KbcZLSQ TwxSUvL65OYiSQL0RJPMFpVkp1GCWD0UcHoq7YHyzJ4aFCMPkhoJXA5yNm+LPtj/LTtc WVyVeWjFiKe6N37goagpNfTfvBEjlrr2Eg4J2yUMdO0tqp3Oo2k9e2MnWIWGTUab/6mb IAQmWxCgD4MnrGvz0dIU7CAxiK84LdlXUA40jHXECkyJx/O1/eIUTUMYimJN03dnpPJU f7aLUmqwcM9MNOjtEZPbu397zr4iwafiozTe9tr8X9U5RFatGAQ3iSIg61FwzLNVmSHq WLLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=QU2E8oF5JNAbYAlglR/3BSATG0M/9oeZpEn5cOfx658=; b=ZxRMWtYoql3A2KAQKdTumFYBZNI7eXZEK4xlN/e2QGguVehnOhf+qhirTfhEDwykRR 1GEpsZ/urY+iNLud+TVQCHDvMqOfr6ApLZ91BDx/OazRsyTZ9G7DyR7rt9nKZHuCB++3 mNOfHLLfjy/EAjQhgaD2CLgaIdoQ81MwSNrhDMGikKFWFW/jrEhn1scfruguWK9cfmk8 pIMPq6Me/qf3UgCGmqCcjfe2ba/trfN43udhORegBsd4eMo1cu+YhN2oP/vZ9crKnxEQ puUmekoe772N6leMBJMle8a4eR1A5gG4kt9ijgqlz9oU+TtCgwI7r2Tr8g8sfU0yhYzD vg6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si7139459oij.200.2020.01.14.01.32.35; Tue, 14 Jan 2020 01:32:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728826AbgANJbZ (ORCPT + 99 others); Tue, 14 Jan 2020 04:31:25 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40399 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgANJbZ (ORCPT ); Tue, 14 Jan 2020 04:31:25 -0500 Received: by mail-wm1-f67.google.com with SMTP id t14so12831835wmi.5; Tue, 14 Jan 2020 01:31:24 -0800 (PST) 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=QU2E8oF5JNAbYAlglR/3BSATG0M/9oeZpEn5cOfx658=; b=dTbjrvDYZFckqKtBKudHY/wanT9oRcRmu4cjV/a682HzEzAyq/phigDGXrIGdRNAWX Xmj65hrbyMh88uIlkVYCJ9C0bWzzjqOXF3T1fAeHlTIyvTgSt9our1d8v+FIPYRavm44 taCE3FK0oQe65Rmyivv4y0S6Bq7N8CK10H79Uz6JFa1imu6cf3fpE7uDq/RBCmWHUxj7 vWK3n++WEKeCWbufBHhlwlAbKdcZ3ax89Eo6Xb4LUPA1FWcaUVs3KC28/OJCZIrY+tIW H69aRpDOImg+Dtyzh6fGcL68gdrk5lRPsdLdcPFx1uN9kqpFgAWWYmbkIJoepEKIoogW NXpw== X-Gm-Message-State: APjAAAVSPTJ8GyAWIICK6MDLGafPARBDjPup5sv0WpALUaUmbI3bTZRW vm1ZAmlp3tJb0+MYjICx5lw= X-Received: by 2002:a1c:541b:: with SMTP id i27mr26849300wmb.137.1578994283622; Tue, 14 Jan 2020 01:31:23 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id e16sm18915745wrs.73.2020.01.14.01.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 01:31:22 -0800 (PST) Date: Tue, 14 Jan 2020 10:31:22 +0100 From: Michal Hocko To: "Kirill A. Shutemov" 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: <20200114093122.GH19428@dhcp22.suse.cz> References: <20200109143054.13203-1-richardw.yang@linux.intel.com> <20200111000352.efy6krudecpshezh@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200111000352.efy6krudecpshezh@box> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- Michal Hocko SUSE Labs