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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 DEEFCC433DB for ; Tue, 12 Jan 2021 10:13:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3C56A22CBE for ; Tue, 12 Jan 2021 10:13:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C56A22CBE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A0B7A6B0187; Tue, 12 Jan 2021 05:13:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9930F6B0201; Tue, 12 Jan 2021 05:13:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80EB86B0202; Tue, 12 Jan 2021 05:13:47 -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 6B4936B0187 for ; Tue, 12 Jan 2021 05:13:47 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 367F5181AC217 for ; Tue, 12 Jan 2021 10:13:47 +0000 (UTC) X-FDA: 77696711694.16.pet90_050034827514 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 19864100E690B for ; Tue, 12 Jan 2021 10:13:47 +0000 (UTC) X-HE-Tag: pet90_050034827514 X-Filterd-Recvd-Size: 4261 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Jan 2021 10:13:46 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id p12so1291822pju.5 for ; Tue, 12 Jan 2021 02:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mY8MybgGMFbo1rC5H8TQU94N3Kb/DFvasQ9m5cTkwXs=; b=wCY57lWHUIgLP2FDNXDOKdzL/H6OgCcH8g4MAefiujLmQtrsF+E/kALUe/qog9Rhr8 mvn0VVtdLHiouNOo7EjVoge/SONbmvyR0ZqMf2ojtNCmO9XCAzMafK0uGhs3k1h/URrv JIwRwU6vnhJt9B7+IdM40cvTH/0ahQmx4GNxAk2mrC9OxV5tqBND15FI+sExak91NLw3 97jvsyhjDH2/hWgHlH9ZYFI3AS7ctiaIHQkGPo3BGdI8jEZff6yUSt/qg6TnbtMuTof9 H61edkeMGT1icNNQvyoFs7dTrUoAM3zbipZMNkKFLoFVZed9Zmd4nuyXxPoAeoa1spYb GCAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mY8MybgGMFbo1rC5H8TQU94N3Kb/DFvasQ9m5cTkwXs=; b=pFPTU8AQ+guvILcnDmQSkUZi/yV09Ugn/StZYEEBnFSCLiWevhhclVkpGJ3UEf0PKQ 8X9WegkbPgccbLCJyhX0Ze9xSA81I63IWsD5M6QZUqD0Uc8ZCpytCDbcYtQyegkaA9cF 7ZF7mkSF8VvQixt3EsQbCuCtxxUht6qQxUinRaqodft1JmIKZuGl/+sfMg2ghfVbRGVa nq64FqCg1PqssxLtkMAA4DIBPsEcn/Sz8BSGyy9vjpxUdBv+mVYlnr8o2KxvJTAVOjTs il+HrRnO84PYWzE0xscQymU+NYhKL1wQyzqkWZoAWOvqFA5aa/UKhn73sneVs7ebkwuQ hWbg== X-Gm-Message-State: AOAM531+eGzsN518eh5hVqxRYOXQtTOVCeLLpGC5Ks4F4JDQtGC2tYEd /yW5/sUjgJknaGM5YztmeqN7NZ/6f7rHngWr7bHvkg== X-Google-Smtp-Source: ABdhPJxyaUnzFN35cP+WtGSHkOnQlRu2Pwk/F/lCiCoPhLPtHWoBPh3yMZ5ZS4hmMe8y9fq3ZpwGpBo0sKqkICVJg/I= X-Received: by 2002:a17:902:ed0d:b029:da:c83b:5f40 with SMTP id b13-20020a170902ed0db02900dac83b5f40mr4112174pld.20.1610446425119; Tue, 12 Jan 2021 02:13:45 -0800 (PST) MIME-Version: 1.0 References: <20210110124017.86750-1-songmuchun@bytedance.com> <20210110124017.86750-4-songmuchun@bytedance.com> <20210112100213.GK22493@dhcp22.suse.cz> In-Reply-To: <20210112100213.GK22493@dhcp22.suse.cz> From: Muchun Song Date: Tue, 12 Jan 2021 18:13:02 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v3 3/6] mm: hugetlb: fix a race between freeing and dissolving the page To: Michal Hocko Cc: Mike Kravetz , Andrew Morton , Naoya Horiguchi , Andi Kleen , Linux Memory Management List , LKML , linux- stable Content-Type: text/plain; charset="UTF-8" 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 12, 2021 at 6:02 PM Michal Hocko wrote: > > On Sun 10-01-21 20:40:14, Muchun Song wrote: > [...] > > @@ -1770,6 +1788,14 @@ int dissolve_free_huge_page(struct page *page) > > int nid = page_to_nid(head); > > if (h->free_huge_pages - h->resv_huge_pages == 0) > > goto out; > > + > > + /* > > + * We should make sure that the page is already on the free list > > + * when it is dissolved. > > + */ > > + if (unlikely(!PageHugeFreed(head))) > > + goto out; > > + > > Do you really want to report EBUSY in this case? This doesn't make much > sense to me TBH. I believe you want to return 0 same as when you race > and the page is no longer PageHuge. Return 0 is wrong. Because the page is not freed to the buddy allocator. IIUC, dissolve_free_huge_page returns 0 when the page is already freed to the buddy allocator. Right? > > > /* > > * Move PageHWPoison flag from head page to the raw error page, > > * which makes any subpages rather than the error page reusable. > > -- > > 2.11.0 > > -- > Michal Hocko > SUSE Labs