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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 5E331C433DB for ; Thu, 7 Jan 2021 09:02:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A73DB2313C for ; Thu, 7 Jan 2021 09:02:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A73DB2313C 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 C1BDA8D012C; Thu, 7 Jan 2021 04:01:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA4F18D011F; Thu, 7 Jan 2021 04:01:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A45948D012C; Thu, 7 Jan 2021 04:01:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 8A1E68D011F for ; Thu, 7 Jan 2021 04:01:59 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 539BC824556B for ; Thu, 7 Jan 2021 09:01:59 +0000 (UTC) X-FDA: 77678386758.12.veil84_3811ccd274e9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 24EFA180363F8 for ; Thu, 7 Jan 2021 09:01:59 +0000 (UTC) X-HE-Tag: veil84_3811ccd274e9 X-Filterd-Recvd-Size: 5003 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Jan 2021 09:01:58 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id w1so3774509pjc.0 for ; Thu, 07 Jan 2021 01:01:57 -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:content-transfer-encoding; bh=7IFTVMzZ+aecicXR0s8XBfFgUlitNACcIOq23fQzejY=; b=WuAdrPbD88PrGbyE3Tl9KLmQ5F2OP1aIHh+gkjDtptyrjJcEgtFkUEYH/YUKPQmINI V1Jao6+pUYML7SgHjgD1l/79KOR+NjPZyD42AcdmSxkQQkSVfUeJcXgElaBPQX81lE8C LGlKbWattF/+LUCULuAn/mJroCVzzRWlDtBwrD1B6GT8MFv8KS4CcsxUshxLhUEvtVts UgujmbAFRmoSmkdzv2+gBrhopz8J8qXaWw4ym1Bc4Yi1CQDOkzLbXQrB/gZRIjLij5wQ QAJ0x15bQZ+6FqtRoqrv+fjC5igdWocWxEJv23eDqjDuBpvDqk9kBa8kAiPJZSrNMiby zb6g== 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:content-transfer-encoding; bh=7IFTVMzZ+aecicXR0s8XBfFgUlitNACcIOq23fQzejY=; b=JxOFViWiKV7MqTJulqSqxZ3kmj3lcrLfMxzECBwzuL2b68d2UPyKwjIRC17obHumYy +RdiAWo59xZFCKGgedxhGguWwN3vD9hjgZJivkl16e/NSpDutDxhYJdF4OR7hh0EwFDe jPu+bcNevhpuZuPZ+SckIM3YmZzL7ltZMmV+pPrsaMimkkaPx0hsBW3iXNDbDtZpfVcG BSKU+cP5dyiqXeIzD3vh42yBn0d1igR47yCsKBNQrR03dyHU6ki7P0LBMcj+0JYfEHQj CCJssQzyXcP3Kuf6S3gxdbearCY1uIQdY6VAztnL0YHr4rg+o6XoZWfAx2wAUTA09Zip Q91Q== X-Gm-Message-State: AOAM5325sge5UeQKGepWUtcMd50lYplN7YJ3LEcsIWqFa2c1bIzK7Bj8 aZAzVfLX9flQ3EFrCySHpL6rh7vV//L7uLZsXZW8pA== X-Google-Smtp-Source: ABdhPJyKrW23ttJk7n2Ob5ozrUR8dhuf/eEW558orMpos4uiFr8Pred9DHJB6CePKRgjqFCH1SDrrc1qVpL4OxtFjps= X-Received: by 2002:a17:90a:ba88:: with SMTP id t8mr8307085pjr.229.1610010117074; Thu, 07 Jan 2021 01:01:57 -0800 (PST) MIME-Version: 1.0 References: <20210106084739.63318-1-songmuchun@bytedance.com> <20210106084739.63318-5-songmuchun@bytedance.com> <20210106170754.GU13207@dhcp22.suse.cz> <20210107083902.GB13207@dhcp22.suse.cz> In-Reply-To: <20210107083902.GB13207@dhcp22.suse.cz> From: Muchun Song Date: Thu, 7 Jan 2021 17:01:16 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v2 4/6] mm: hugetlb: add return -EAGAIN for dissolve_free_huge_page To: Michal Hocko Cc: Mike Kravetz , Andrew Morton , Naoya Horiguchi , Andi Kleen , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Thu, Jan 7, 2021 at 4:39 PM Michal Hocko wrote: > > On Thu 07-01-21 11:11:41, Muchun Song wrote: > > On Thu, Jan 7, 2021 at 1:07 AM Michal Hocko wrote: > > > > > > On Wed 06-01-21 16:47:37, Muchun Song wrote: > > > > When dissolve_free_huge_page() races with __free_huge_page(), we ca= n > > > > do a retry. Because the race window is small. > > > > > > Is this a bug fix or mere optimization. I have hard time to tell from > > > the description. > > > > It is optimization. Thanks. > > > > > > > > > Signed-off-by: Muchun Song > > > > --- > > > > mm/hugetlb.c | 26 +++++++++++++++++++++----- > > > > 1 file changed, 21 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > > [...] > > > > @@ -1825,6 +1828,14 @@ int dissolve_free_huge_page(struct page *pag= e) > > > > } > > > > out: > > > > spin_unlock(&hugetlb_lock); > > > > + > > > > + /* > > > > + * If the freeing of the HugeTLB page is put on a work queue,= we should > > > > + * flush the work before retrying. > > > > + */ > > > > + if (unlikely(rc =3D=3D -EAGAIN)) > > > > + flush_work(&free_hpage_work); > > > > > > Is it safe to wait for the work to finish from this context? > > > > Yes. It is safe. > > Please expand on why in the changelog. Same for the optimization > including some numbers showing it really helps. OK. Changelog should be updated. Do you agree the race window is quite small? If so, why is it not an optimization? Don=E2=80=99t we diss= olve the page as successfully as possible when we call dissolve_free_huge_page()? I am confused about numbers showing. Because this is not a performance optimization, but an increase in the success rate of dissolving. Thanks. > > -- > Michal Hocko > SUSE Labs