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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 E6AB8C433E0 for ; Thu, 7 Jan 2021 11:26:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4C22208C3 for ; Thu, 7 Jan 2021 11:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727590AbhAGL0W (ORCPT ); Thu, 7 Jan 2021 06:26:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbhAGL0W (ORCPT ); Thu, 7 Jan 2021 06:26:22 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07DEC0612F5 for ; Thu, 7 Jan 2021 03:25:40 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id c79so3679235pfc.2 for ; Thu, 07 Jan 2021 03:25:40 -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=OPYoUF04sANxUtBvsIvdeDWelO8MgjMrgBU4JJEctH0=; b=TvudalW7R6i7/vU9sTrkO4sh60H3U4/8P27eO63GcrPpBy3bezHyzilID1hR76cu/I aKZ/GdbNTzel2pIxzGeBIuP+SBbh6Q78n3AvutjTCblcEoRSoZdPP3lcSCZEUg7SYb2u Juk4Hr5fhlYpW/itNzug7q/4LAk1/TAkPV3hqa0dj89YBBld8E07srbU70COu6n9Dw5d Vth0eDhESYuibWQ5y0+zE51jDqD5i1IztKMcjw43QLsNfINPPsiAc68KOY3QU4Xn6N5i uPWMtrkdmmPF4Qir2Iu5WetsGUnpOFWTCkvyIk/lKe6Vxl56PgajLsmQ67hMFhB7t+We 6W5g== 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=OPYoUF04sANxUtBvsIvdeDWelO8MgjMrgBU4JJEctH0=; b=Gs4tjrr36ps6+IwQjWWfiGn9SCbTQ0YlUaDKT8pAg5VxH4NG2PplTKsBCL6CL8qD7G gI2ZZ3O3DcSx6fbzNW6QP8uKWj7PtVSPw+Dwi3RzLA/1od59q/3VmBUZ53UXqsLw94mr rmrpsK9yO+GOnlsukSjLIVe7OtO9zO4Kkp6C5Wzh3wFRoPefbbV0ZEV7cFqnqZgveHqF cDLcysPy2oNAWzLXho/bUfLovYLwwlM6iqH8X1VrNSQFqOyRHymbGM1tiEjwJEwdZhkw v3kiXXnyVbXLWUR7/ak2APzec+OIIB963Vel1YInH0nB2FL85/XiZomPjTokRunPCEt+ slVQ== X-Gm-Message-State: AOAM531BW/s1IgilZvQhZHrp2zWgdHFwrEm0wPhvTOOvVJl6GeT01sQv rpHnSLk8TEXx9Sz0+DN9d0yCGq3Mnu1qHJmdD0S3Tg== X-Google-Smtp-Source: ABdhPJzwC4SoLTS/ZVQ8BJgEnbOgZezDkFf7YNbkHo1QTe4S6D0UBaAsfywIcNSjOF5t9mP7NIbVtTxpzYJcnS87Cwo= X-Received: by 2002:a63:480f:: with SMTP id v15mr1369677pga.341.1610018740564; Thu, 07 Jan 2021 03:25:40 -0800 (PST) MIME-Version: 1.0 References: <20210106084739.63318-1-songmuchun@bytedance.com> <20210106084739.63318-2-songmuchun@bytedance.com> <20210106161327.GR13207@dhcp22.suse.cz> <20210107111642.GF13207@dhcp22.suse.cz> In-Reply-To: <20210107111642.GF13207@dhcp22.suse.cz> From: Muchun Song Date: Thu, 7 Jan 2021 19:24:59 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v2 1/6] mm: migrate: do not migrate HugeTLB page whose refcount is one To: Michal Hocko Cc: Mike Kravetz , Andrew Morton , Naoya Horiguchi , Andi Kleen , Linux Memory Management List , LKML , Yang Shi Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 7, 2021 at 7:16 PM Michal Hocko wrote: > > On Thu 07-01-21 10:52:21, Muchun Song wrote: > > On Thu, Jan 7, 2021 at 12:13 AM Michal Hocko wrote: > > > > > > On Wed 06-01-21 16:47:34, Muchun Song wrote: > > > > If the refcount is one when it is migrated, it means that the page > > > > was freed from under us. So we are done and do not need to migrate. > > > > > > Is this common enough that it would warrant the explicit check for each > > > migration? > > > > Are you worried about the overhead caused by the check? Thanks. > > I am not as worried as I would like to see some actual justification for > this optimization. OK. The HugeTLB page can be freed after it was isolated but before being migrated. Right? If we catch this case, it is an optimization. I do this just like unmap_and_move() does for a base page. > -- > Michal Hocko > SUSE Labs 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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 E50DAC433DB for ; Thu, 7 Jan 2021 11:25:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3801A208C3 for ; Thu, 7 Jan 2021 11:25:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3801A208C3 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 A6B0A8D0135; Thu, 7 Jan 2021 06:25:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A19B68D011F; Thu, 7 Jan 2021 06:25:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E2578D0135; Thu, 7 Jan 2021 06:25:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id 78A888D011F for ; Thu, 7 Jan 2021 06:25:42 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 41C00180AD80F for ; Thu, 7 Jan 2021 11:25:42 +0000 (UTC) X-FDA: 77678748924.17.pest00_120be04274e9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 29657180D0185 for ; Thu, 7 Jan 2021 11:25:42 +0000 (UTC) X-HE-Tag: pest00_120be04274e9 X-Filterd-Recvd-Size: 3976 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Jan 2021 11:25:41 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id n10so4610369pgl.10 for ; Thu, 07 Jan 2021 03:25:41 -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=OPYoUF04sANxUtBvsIvdeDWelO8MgjMrgBU4JJEctH0=; b=TvudalW7R6i7/vU9sTrkO4sh60H3U4/8P27eO63GcrPpBy3bezHyzilID1hR76cu/I aKZ/GdbNTzel2pIxzGeBIuP+SBbh6Q78n3AvutjTCblcEoRSoZdPP3lcSCZEUg7SYb2u Juk4Hr5fhlYpW/itNzug7q/4LAk1/TAkPV3hqa0dj89YBBld8E07srbU70COu6n9Dw5d Vth0eDhESYuibWQ5y0+zE51jDqD5i1IztKMcjw43QLsNfINPPsiAc68KOY3QU4Xn6N5i uPWMtrkdmmPF4Qir2Iu5WetsGUnpOFWTCkvyIk/lKe6Vxl56PgajLsmQ67hMFhB7t+We 6W5g== 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=OPYoUF04sANxUtBvsIvdeDWelO8MgjMrgBU4JJEctH0=; b=rnKQ5X/hzNet1Lr5ii7UCfhzyJQL3j2LjkxWtu7xGlt3iRdbzAqZBZnOm2AKFFgrDu 4+fwiWA8tqFwwTIQd1/4xK9TsYuYW+VJAz8UTZRH9XGuimT/prc5tTYaRVmITksAyT6U 2sCwFEBKMBNe8saPRZI6+tBKf2Sgm8+BKjhB7t3wwnqTKHzuJF5Y1zNdW72WDkmppMPs VCyEroExrG4ZRW//Homlpx15D98M8cEhkzmwKpQUlepFfQP78croAdWpI6JGx32TCVDW MwVOxZu2Qlv381idjgmsx0UnyADC9ltSOhjK4DDbGFgSbD9JYRDzktVk6EPNS8Muq8ep ubYQ== X-Gm-Message-State: AOAM532cAuYMN3dRmxQQYDnZGy9mDaA3Cu65e2H/gYjHYQcrv/zo/mGo Ij3fcY3sESYxMrjTihB4e/MiEe5I+oZlcM+uemnr9A== X-Google-Smtp-Source: ABdhPJzwC4SoLTS/ZVQ8BJgEnbOgZezDkFf7YNbkHo1QTe4S6D0UBaAsfywIcNSjOF5t9mP7NIbVtTxpzYJcnS87Cwo= X-Received: by 2002:a63:480f:: with SMTP id v15mr1369677pga.341.1610018740564; Thu, 07 Jan 2021 03:25:40 -0800 (PST) MIME-Version: 1.0 References: <20210106084739.63318-1-songmuchun@bytedance.com> <20210106084739.63318-2-songmuchun@bytedance.com> <20210106161327.GR13207@dhcp22.suse.cz> <20210107111642.GF13207@dhcp22.suse.cz> In-Reply-To: <20210107111642.GF13207@dhcp22.suse.cz> From: Muchun Song Date: Thu, 7 Jan 2021 19:24:59 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v2 1/6] mm: migrate: do not migrate HugeTLB page whose refcount is one To: Michal Hocko Cc: Mike Kravetz , Andrew Morton , Naoya Horiguchi , Andi Kleen , Linux Memory Management List , LKML , Yang Shi 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 Thu, Jan 7, 2021 at 7:16 PM Michal Hocko wrote: > > On Thu 07-01-21 10:52:21, Muchun Song wrote: > > On Thu, Jan 7, 2021 at 12:13 AM Michal Hocko wrote: > > > > > > On Wed 06-01-21 16:47:34, Muchun Song wrote: > > > > If the refcount is one when it is migrated, it means that the page > > > > was freed from under us. So we are done and do not need to migrate. > > > > > > Is this common enough that it would warrant the explicit check for each > > > migration? > > > > Are you worried about the overhead caused by the check? Thanks. > > I am not as worried as I would like to see some actual justification for > this optimization. OK. The HugeTLB page can be freed after it was isolated but before being migrated. Right? If we catch this case, it is an optimization. I do this just like unmap_and_move() does for a base page. > -- > Michal Hocko > SUSE Labs