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 CA69EC433F5 for ; Thu, 23 Sep 2021 03:08:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2FFA610A1 for ; Thu, 23 Sep 2021 03:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238981AbhIWDJh (ORCPT ); Wed, 22 Sep 2021 23:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238905AbhIWDJg (ORCPT ); Wed, 22 Sep 2021 23:09:36 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57CABC061574 for ; Wed, 22 Sep 2021 20:08:05 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id dj4so18096162edb.5 for ; Wed, 22 Sep 2021 20:08:05 -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=Wg0SO8Jh5J0YtYhTMPuXq9iTZK0y4Tf/EQSdxnLWV6M=; b=agaNwmejKv2RaiO2sHI4XtD5iYj8+bycsl45DOQzbBaglm4ipkIi2QPOzqU2kWk2mm PPFDafbkQ8L+/4k2gALrZbxckEmceL9xd3rIzqFWAM6kjymOTe8kSIlG/TWQy7GZqOHZ I9VZyLiinPeK4Svx4Z2+z8YlGivEaULY+Ttq8jQabjFsUAud67KrCh813gck4GcCfWGo D0kjpmQQ9D8eUfAHWMg2kR91BzZMe9mZbOZaPpdMC0rdZ8rDt0bTC7gMoARdAbLDh5ss y7hqG3LF0QRjX7vTYb2T5cCUo0BkdWVfuynwmGHisMEmiAYXuu3W0GIkt6+HKMGJVqx/ reOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wg0SO8Jh5J0YtYhTMPuXq9iTZK0y4Tf/EQSdxnLWV6M=; b=3Ld/VsnO2uVX41iGOUjdkdLihxHsGqSVGiB/ZD1SFBW56CNcBu4ky0VgjK6TimCEEp sZtHNHh5kY6SjgO3IiEpvqpVgoASzAYcytAOn/RYcANOP09TW5bh+PJsBOk/maVhCQ1C fb2Ve81SSoNoz2h72vNb8iy8s3dpwfd9JNMkQdKADOcrth80cy62VvR4Kq3LgAwXN044 tHPQiXpx6tv9fNfShAeRxEZJwAq2rpmVSuw3U1pEPJgRXrYxkoeDgE/i1zStBzNcKu0t xmw1meKcGX0G/wYyA992Uy1/UqWSY/QoSvePRLJiDG7idXtb8Ac9KSyTjpNyKcHBGVnx lOAg== X-Gm-Message-State: AOAM531lEVcEOHJ4XbMCtUsIaLzdHchlJTpTNi+Zp6MFyG8tLDeDqnXo vuprD4e5fniiCtBEhpp8Z4XkjSg0K0V/4Z5BK8+CGtv6 X-Google-Smtp-Source: ABdhPJzu3mm/ITq06L7qrX4Em+cFaEhnqUYjo7bf3jJIhMdlebmUff5pYc0jURAsRAd9mzEkVIR8K4uuVXSRzHEYAQ4= X-Received: by 2002:a05:6402:16c8:: with SMTP id r8mr2939958edx.101.1632366483922; Wed, 22 Sep 2021 20:08:03 -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: From: Yang Shi Date: Wed, 22 Sep 2021 20:07:51 -0700 Message-ID: Subject: Re: [RFC PATCH] mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA To: Hugh Dickins Cc: Vlastimil Babka , "Kirill A. Shutemov" , "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 22, 2021 at 4:49 PM Hugh Dickins wrote: > > On Wed, 1 Sep 2021, Yang Shi wrote: > > 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(). > > It may not be possible, but I'd always imagined that a cleanup of this > kind would get rid of all those "struct page **hpage" artifacts. It seems we need to find another way to do "sleep for the first alloc failure, break loop for the second alloc failure" or just remove the heuristic. I will take a closer look once I find some time. > > Hugh 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 6E9B8C433EF for ; Thu, 23 Sep 2021 03:08:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E7AC960F36 for ; Thu, 23 Sep 2021 03:08:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E7AC960F36 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 00BC46B006C; Wed, 22 Sep 2021 23:08:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFD4B6B0071; Wed, 22 Sep 2021 23:08:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEC46900002; Wed, 22 Sep 2021 23:08:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id CC4546B006C for ; Wed, 22 Sep 2021 23:08:05 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 79CBE1828F6B6 for ; Thu, 23 Sep 2021 03:08:05 +0000 (UTC) X-FDA: 78617354130.38.5CD80A7 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf08.hostedemail.com (Postfix) with ESMTP id 3DBEB30000AC for ; Thu, 23 Sep 2021 03:08:05 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id y89so7239949ede.2 for ; Wed, 22 Sep 2021 20:08:05 -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=Wg0SO8Jh5J0YtYhTMPuXq9iTZK0y4Tf/EQSdxnLWV6M=; b=agaNwmejKv2RaiO2sHI4XtD5iYj8+bycsl45DOQzbBaglm4ipkIi2QPOzqU2kWk2mm PPFDafbkQ8L+/4k2gALrZbxckEmceL9xd3rIzqFWAM6kjymOTe8kSIlG/TWQy7GZqOHZ I9VZyLiinPeK4Svx4Z2+z8YlGivEaULY+Ttq8jQabjFsUAud67KrCh813gck4GcCfWGo D0kjpmQQ9D8eUfAHWMg2kR91BzZMe9mZbOZaPpdMC0rdZ8rDt0bTC7gMoARdAbLDh5ss y7hqG3LF0QRjX7vTYb2T5cCUo0BkdWVfuynwmGHisMEmiAYXuu3W0GIkt6+HKMGJVqx/ reOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wg0SO8Jh5J0YtYhTMPuXq9iTZK0y4Tf/EQSdxnLWV6M=; b=6oVUwmiBA0UGXDY7foqRtOm54zm55QbWfc79srIz1sVGSaYbIIAVVjnjVwpXTK45RJ 1EW/w2eL38cpDacHvpB5Jga8riUlqOcO+6zqT9z6mCAW4PvkbXfIldF4tCIXsQflbHXn IomkMR1an5oWG7/mSn5QjrLY2gw6C1zDavUy3Bsm7jqzSm9f+2cbblaksdgfDPq+XQ6a kSSxD/AcSvoBaPDITsOklgORBrIr62HN9WszmqNgGxW1Nf3TfRpAIzUJWFIeZ++HNYxY 2ZeROIwm2VHEVF4TfoHZSJZDeTEta2MSdf8kOvEda92qgah/j1HtJQVxcdoZw77zNR2c Sb6A== X-Gm-Message-State: AOAM5336uDlBwbwPW4SB5x3LSGsUMyFe0A3eTg8i4f7nGaBSD89yHF2g cPJ8YK/1+gDSKpyK0BRAfNu5XFgaSjCdgXkManw= X-Google-Smtp-Source: ABdhPJzu3mm/ITq06L7qrX4Em+cFaEhnqUYjo7bf3jJIhMdlebmUff5pYc0jURAsRAd9mzEkVIR8K4uuVXSRzHEYAQ4= X-Received: by 2002:a05:6402:16c8:: with SMTP id r8mr2939958edx.101.1632366483922; Wed, 22 Sep 2021 20:08:03 -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: From: Yang Shi Date: Wed, 22 Sep 2021 20:07:51 -0700 Message-ID: Subject: Re: [RFC PATCH] mm: khugepaged: don't carry huge page to the next loop for !CONFIG_NUMA To: Hugh Dickins Cc: Vlastimil Babka , "Kirill A. Shutemov" , "Kirill A. Shutemov" , Andrew Morton , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=agaNwmej; spf=pass (imf08.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3DBEB30000AC X-Stat-Signature: 5fxgufeqz9ckz5xc6uczyo34bozwk5fh X-HE-Tag: 1632366485-253162 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 22, 2021 at 4:49 PM Hugh Dickins wrote: > > On Wed, 1 Sep 2021, Yang Shi wrote: > > 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(). > > It may not be possible, but I'd always imagined that a cleanup of this > kind would get rid of all those "struct page **hpage" artifacts. It seems we need to find another way to do "sleep for the first alloc failure, break loop for the second alloc failure" or just remove the heuristic. I will take a closer look once I find some time. > > Hugh