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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 0A271C432BE for ; Wed, 1 Sep 2021 17:26:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4FF560FD7 for ; Wed, 1 Sep 2021 17:26:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344578AbhIAR1H (ORCPT ); Wed, 1 Sep 2021 13:27:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344491AbhIAR1F (ORCPT ); Wed, 1 Sep 2021 13:27:05 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2610C061575 for ; Wed, 1 Sep 2021 10:26:08 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id e21so623364ejz.12 for ; Wed, 01 Sep 2021 10:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sp7XBpDsEWktebv2KujX7GIfrROhmlrwow2+XWTBKgA=; b=S8CnjdOpj1yWZxAPozi1aKqrUt6D2+mKIIRSpT8IaKG6MZnc566+G2YjaELRMbA/EF 8MH0AyCUuSminMsWPbEVWaGoQo5MCZihJcGoP81f0s72L26RhuJrdXLto/fR1JU2UCou gfj3tI4JYQp1O3spGM+JjDbf2P/HOo6dzoYfF3ykrl+k/ijI7jEOyNvw+LpW4M1g9Ilu lmX5yK6G9cHzmhLzJ8viNYPpEnB9ECc5CotfiOyP36zAlSAHsMYdDjloK4Cr+OVXzshs P02GIa3xin37g3+iXJHpZbTHNbp8WmEuDvakWYJfpiV3qsvDp0UgWbwH124JEqDGfGSm 90PQ== 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=sp7XBpDsEWktebv2KujX7GIfrROhmlrwow2+XWTBKgA=; b=V3IF/7u+gsw++nchYeJ3MWonSoTjFB8c2ODrDf6bn+/UHYuwPCA73GPP9zgzECMd1h tsBAb4KfasN4VEVNnFYnrUjQVUyP+LStTC/VKHmz0hr1Q1H4OoLYCsyJVvSlDmmrSaE2 VlBYB5KvIcPmc/eRqRGS+L/JR8vXxS66oW3WNQaj8aDG0GPJaj4P4SJ7f/x1Tb5bJhMy kf77eGmaIG7JwMiQW6pVybOODZkviVilavOYsgzgEZHP0dSikzeZCZu8GsspnZFOgir9 oGKJIot3xno8/CpdJ+6uBQepTuSmDjbEct9V2fnJG8oGcm2GW2LkfL5zmPbGYq10NnyG CGOA== X-Gm-Message-State: AOAM531bmdZHID9Z35b/zFZ7BlcG5veTufDm/xRIaJBnrnFdJ8iI79Iw TJJCGNn3X24WpORUJfiaTRYOJ5fjm9BhbYmAd4ut+v6gGD0= X-Google-Smtp-Source: ABdhPJx1SUHv7MuyaoC+T7PFlhNvDfFhkTJJ6L2plSxYx0lYk02nP3kpVVQd7lSS6i++h7JLyOHc23F3u3RZZAansG4= X-Received: by 2002:a17:906:cc81:: with SMTP id oq1mr608346ejb.25.1630517166010; Wed, 01 Sep 2021 10:26:06 -0700 (PDT) MIME-Version: 1.0 References: <20210817202146.3218-1-shy828301@gmail.com> <20210831233839.afaenhn32nx6m2fq@box.shutemov.name> <07fd6599-88cc-e353-26f0-5de3eeea5b9f@suse.cz> In-Reply-To: <07fd6599-88cc-e353-26f0-5de3eeea5b9f@suse.cz> From: Yang Shi Date: Wed, 1 Sep 2021 10:25:53 -0700 Message-ID: Subject: Re: [RFC PATCH] mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA To: Vlastimil Babka Cc: "Kirill A. Shutemov" , Hugh Dickins , "Kirill A. Shutemov" , Andrew Morton , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 1, 2021 at 3:26 AM Vlastimil Babka wrote: > > On 9/1/21 05:46, Yang Shi wrote: > > On Tue, Aug 31, 2021 at 4:38 PM Kirill A. Shutemov wrote: > >> > >> On Mon, Aug 30, 2021 at 11:49:43AM -0700, Yang Shi wrote: > >> > Gently ping... > >> > > >> > Does this patch make sense? BTW, I have a couple of other khugepaged > >> > related patches in my queue. I plan to send them with this patch > >> > together. It would be great to hear some feedback before resending > >> > this one. > >> > >> I don't really care for !NUMA optimization. I believe that most of setups > >> that benefit from THP has NUMA enabled compile time. > > > > Agreed. > > > >> > >> But if you wanna to go this path, make an effort to cleanup other > >> artifacts for the !NUMA optimization: the ifdef has to be gone and all > >> callers of these helpers has to be revisited. There's more opportunities to > >> cleanup. Like it is very odd that khugepaged_prealloc_page() frees the > >> page. > > > > Yes, they are gone in this patch. The only remaining for !NUMA is > > khugepaged_find_target_node() which just returns 0. > > As Kirill pointed out, there's also khugepaged_prealloc_page() where the > only remaining variant does actually no preallocation, just freeing of an > unused page and some kind of "sleep after first alloc fail, break after > second alloc fail" logic. > This could now be moved to khugepaged_do_scan() loop itself and maybe it > will be easier to follow. Aha, I see. Misunderstood him. I'm supposed that you mean move into khugepaged_scan_mm_slot(). > > >> > >> > >> -- > >> Kirill A. Shutemov > > > 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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 D1925C4320A for ; Wed, 1 Sep 2021 17:26:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 707E560FD7 for ; Wed, 1 Sep 2021 17:26:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 707E560FD7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 15CD08D0003; Wed, 1 Sep 2021 13:26:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 10C988D0001; Wed, 1 Sep 2021 13:26:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0236A8D0003; Wed, 1 Sep 2021 13:26:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id E553A8D0001 for ; Wed, 1 Sep 2021 13:26:07 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8D33F8249980 for ; Wed, 1 Sep 2021 17:26:07 +0000 (UTC) X-FDA: 78539682774.13.276697E Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by imf18.hostedemail.com (Postfix) with ESMTP id 5444F4002085 for ; Wed, 1 Sep 2021 17:26:07 +0000 (UTC) Received: by mail-ej1-f42.google.com with SMTP id x11so844672ejv.0 for ; Wed, 01 Sep 2021 10:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sp7XBpDsEWktebv2KujX7GIfrROhmlrwow2+XWTBKgA=; b=S8CnjdOpj1yWZxAPozi1aKqrUt6D2+mKIIRSpT8IaKG6MZnc566+G2YjaELRMbA/EF 8MH0AyCUuSminMsWPbEVWaGoQo5MCZihJcGoP81f0s72L26RhuJrdXLto/fR1JU2UCou gfj3tI4JYQp1O3spGM+JjDbf2P/HOo6dzoYfF3ykrl+k/ijI7jEOyNvw+LpW4M1g9Ilu lmX5yK6G9cHzmhLzJ8viNYPpEnB9ECc5CotfiOyP36zAlSAHsMYdDjloK4Cr+OVXzshs P02GIa3xin37g3+iXJHpZbTHNbp8WmEuDvakWYJfpiV3qsvDp0UgWbwH124JEqDGfGSm 90PQ== 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=sp7XBpDsEWktebv2KujX7GIfrROhmlrwow2+XWTBKgA=; b=p3BUJ23Q+juE+AD7Pq448fPh72iUlqrnQH7yb7PRSoSqFXIPYmpnau313dutvtv0z4 3QLtbDKkK/GRTDXeBlEMjqmakXnBZ1Ew/tgRRvIQtrLI+1jvfxnVo34LnDOiN4JzcF5g Zcf3dyUoCIa+BzpM2TgBQlvxQspFb+uqwCYNdIj+MQGdYCBe3WIx76/b2Okqk7Vnt95f HXI/0oZNBi0yBtM6Ui/hpVXTgWvouVWQKrArPvNn/rQv1eqhVYdoKphP3KPaLw1k5Vtq eH7qZXThVp0jBnd+EVPQn+q2uie/W+kx7zA8y2QGDG2NFOZVbBfmLsR9GI15PP+u7eAP VmtQ== X-Gm-Message-State: AOAM533tJ1gnBo3yWNF33n8+T80//+TfJVIhyzJERsWDvhasMEsUVbIe EbcdxhBFfY1VUtfr4Mke7Y2LlZGI/runyzL7txM= X-Google-Smtp-Source: ABdhPJx1SUHv7MuyaoC+T7PFlhNvDfFhkTJJ6L2plSxYx0lYk02nP3kpVVQd7lSS6i++h7JLyOHc23F3u3RZZAansG4= X-Received: by 2002:a17:906:cc81:: with SMTP id oq1mr608346ejb.25.1630517166010; Wed, 01 Sep 2021 10:26:06 -0700 (PDT) MIME-Version: 1.0 References: <20210817202146.3218-1-shy828301@gmail.com> <20210831233839.afaenhn32nx6m2fq@box.shutemov.name> <07fd6599-88cc-e353-26f0-5de3eeea5b9f@suse.cz> In-Reply-To: <07fd6599-88cc-e353-26f0-5de3eeea5b9f@suse.cz> From: Yang Shi Date: Wed, 1 Sep 2021 10:25:53 -0700 Message-ID: Subject: Re: [RFC PATCH] mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA To: Vlastimil Babka Cc: "Kirill A. Shutemov" , Hugh Dickins , "Kirill A. Shutemov" , Andrew Morton , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 5444F4002085 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=S8CnjdOp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of shy828301@gmail.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam01 X-Stat-Signature: gkuoo3dw3crgjawkfrjawhcrqfbr7m69 X-HE-Tag: 1630517167-657169 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 Wed, Sep 1, 2021 at 3:26 AM Vlastimil Babka wrote: > > On 9/1/21 05:46, Yang Shi wrote: > > On Tue, Aug 31, 2021 at 4:38 PM Kirill A. Shutemov wrote: > >> > >> On Mon, Aug 30, 2021 at 11:49:43AM -0700, Yang Shi wrote: > >> > Gently ping... > >> > > >> > Does this patch make sense? BTW, I have a couple of other khugepaged > >> > related patches in my queue. I plan to send them with this patch > >> > together. It would be great to hear some feedback before resending > >> > this one. > >> > >> I don't really care for !NUMA optimization. I believe that most of setups > >> that benefit from THP has NUMA enabled compile time. > > > > Agreed. > > > >> > >> But if you wanna to go this path, make an effort to cleanup other > >> artifacts for the !NUMA optimization: the ifdef has to be gone and all > >> callers of these helpers has to be revisited. There's more opportunities to > >> cleanup. Like it is very odd that khugepaged_prealloc_page() frees the > >> page. > > > > Yes, they are gone in this patch. The only remaining for !NUMA is > > khugepaged_find_target_node() which just returns 0. > > As Kirill pointed out, there's also khugepaged_prealloc_page() where the > only remaining variant does actually no preallocation, just freeing of an > unused page and some kind of "sleep after first alloc fail, break after > second alloc fail" logic. > This could now be moved to khugepaged_do_scan() loop itself and maybe it > will be easier to follow. Aha, I see. Misunderstood him. I'm supposed that you mean move into khugepaged_scan_mm_slot(). > > >> > >> > >> -- > >> Kirill A. Shutemov > > >