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.5 required=3.0 tests=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 5FEDCC33C9B for ; Tue, 7 Jan 2020 08:38:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2E463206DB for ; Tue, 7 Jan 2020 08:38:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E463206DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA8288E0001; Tue, 7 Jan 2020 03:38:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B31A68E001E; Tue, 7 Jan 2020 03:38:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A07D98E0001; Tue, 7 Jan 2020 03:38:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 871728E0001 for ; Tue, 7 Jan 2020 03:38:11 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 438DA5840 for ; Tue, 7 Jan 2020 08:38:11 +0000 (UTC) X-FDA: 76350185982.13.sofa51_2a521ce591a1b X-HE-Tag: sofa51_2a521ce591a1b X-Filterd-Recvd-Size: 3351 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jan 2020 08:38:10 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id q9so17963592wmj.5 for ; Tue, 07 Jan 2020 00:38:10 -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=SGM8vCSlpFGCG/2t5WreFm3qVTUhAAZYlmJ6tgri9vo=; b=ARyeYLSEP3FeQQ8eoHDvdZ7yAQlvgC09Im30X1nM5aJA7vGl+i8Wzl0gsb6UnrkujA 8/kkDeobQMHpa3ly9HdWbtOlQ+k57U06Bx6cGkU15d89hzzmPoHoXFMKIO3Pg4XEvEgY rurBXmRX4Lxa52OY4cfYN90glpZdZ9w4X9Owrgln4Nb3/u6CnxnDNYZtqqFrztaarmhf MYI7wIEzviLBrgqfKJs1yfIe5rhFkfTINFdv5tUpQ/PbkTLFUzYgsRdlYjPS3J+Vn6Zh EtQ0F6Vqv9hPrHFLHFuX1ucGTOeSc988q7nFZnoMhHUNWpyM7+cLGKY4FpCkIgmmc8nM OmOg== X-Gm-Message-State: APjAAAVsaQn0NFH+1/yZfT+5xCowMPi+icBYSH6ZzoSFQrcLSmnHL6OX QxUnMVvwOfIkTmw+Mh+TIpU= X-Google-Smtp-Source: APXvYqy0l2pPimu0jmfAhj7eC6jxjBqL6qeDNUL2ENjX4Pdxdm00JiUu0Ra5iiAEjLelBdmYD4+x6w== X-Received: by 2002:a05:600c:141:: with SMTP id w1mr38077892wmm.61.1578386289713; Tue, 07 Jan 2020 00:38:09 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id w19sm25365788wmc.22.2020.01.07.00.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 00:38:08 -0800 (PST) Date: Tue, 7 Jan 2020 09:38:08 +0100 From: Michal Hocko To: Wei Yang Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang.shi@linux.alibaba.com Subject: Re: [RFC PATCH] mm: thp: grab the lock before manipulation defer list Message-ID: <20200107083808.GC32178@dhcp22.suse.cz> References: <20200103143407.1089-1-richardw.yang@linux.intel.com> <20200106102345.GE12699@dhcp22.suse.cz> <20200107012241.GA15341@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200107012241.GA15341@richard> User-Agent: Mutt/1.12.2 (2019-09-21) 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 07-01-20 09:22:41, Wei Yang wrote: > On Mon, Jan 06, 2020 at 11:23:45AM +0100, Michal Hocko wrote: > >On Fri 03-01-20 22:34:07, Wei Yang wrote: > >> As all the other places, we grab the lock before manipulate the defer list. > >> Current implementation may face a race condition. > > > >Please always make sure to describe the effect of the change. Why a racy > >list_empty check matters? > > > > Hmm... access the list without proper lock leads to many bad behaviors. My point is that the changelog should describe that bad behavior. > For example, if we grab the lock after checking list_empty, the page may > already be removed from list in split_huge_page_list. And then list_del_init > would trigger bug. And how does list_empty check under the lock guarantee that the page is on the deferred list? -- Michal Hocko SUSE Labs