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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 997F9C04A6A for ; Wed, 2 Aug 2023 15:17:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 216DB2801B5; Wed, 2 Aug 2023 11:17:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C5F92801AA; Wed, 2 Aug 2023 11:17:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 097FA2801B5; Wed, 2 Aug 2023 11:17:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id ECB242801AA for ; Wed, 2 Aug 2023 11:17:19 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BF18080EA3 for ; Wed, 2 Aug 2023 15:17:19 +0000 (UTC) X-FDA: 81079518198.09.466B4B0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id DDFE92002A for ; Wed, 2 Aug 2023 15:17:16 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SWxW84pY; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Sjk94RZ4; spf=pass (imf03.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690989437; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w+0KWNa1xwubY/Ggk8izjhhZVuMUOv4VLooz2GsqEHg=; b=oBBQ/4GRepzeSuFKGHuVxyPfhWKZhki438XyU9yHvNU7RaWJBfbinIP7njeUnVOloOKRP2 ZRDj1Cj+d6EAuF9ydRVL04saXxm1W+w8mWXRxP9ztsh/GRWPaak0yoXSp42iQrkH6gSsUS d7t8pLIzCvjjRR0dMtggYo38gw62TkY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690989437; a=rsa-sha256; cv=none; b=2F6GwL4VXng+wSxIrqE1Hz//Q0QSOmOgEjXD+4KBtZMjVzANKXuwoxcSHrUXuzd6Mii/O2 CQttI0h/m2u23/jsd3jj3FAX/nvDwMse0mV7TiyKhDL75tbLzVpTFKCB5JmGU47Z+z06Je L8OO/mMPos+bzI3jYN7zxkLpt+GeyKo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SWxW84pY; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Sjk94RZ4; spf=pass (imf03.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690989133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w+0KWNa1xwubY/Ggk8izjhhZVuMUOv4VLooz2GsqEHg=; b=SWxW84pY93ZvXp+k57vxxvhS52f/J8VeuKAdimshI5vQJG9fOBK0C6EumwXWAr69VXptGj nV16gglJ77czKbVcSTExE5hsakSo3h1QY5gUHExyXHpYQlRiH+MTTC87wUPMj2Sqb6r8cn AEVSXjJ5y4FfRBQkJvfMzgCowpUvPkU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690989434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w+0KWNa1xwubY/Ggk8izjhhZVuMUOv4VLooz2GsqEHg=; b=Sjk94RZ4YQksg623+EE6uK/8l0pBOxcor4hXfub5d3aTVlqsMSdocuykz2rvDoIKwwURia mJjuEOHY2CxrR7TrESh7dFlxhhFgPrAWavvAbDtx8c8FDgXqHARrNyzg61Xx8SZPs+3LwU vtFuBDwWy2KAeKwlcgAbs1gN4EXU43w= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-96-HaGtXC27OruggDaVr8Y8qQ-1; Wed, 02 Aug 2023 11:12:11 -0400 X-MC-Unique: HaGtXC27OruggDaVr8Y8qQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3fe2fc65f1fso6354315e9.3 for ; Wed, 02 Aug 2023 08:12:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690989130; x=1691593930; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w+0KWNa1xwubY/Ggk8izjhhZVuMUOv4VLooz2GsqEHg=; b=hJ2EORpxZZyfCmvFSywEyXBD73mhiwiCZoTR5XKgifFmlHYl6wulb8molby7ikK1Uj JfkU4oQNtX7KA4m1KwYxRWn0X8kErfJ5jv8fKp8flF4J6ZF1bLC2AsbBI6qDNuGXadvG pV6CGepSZHAxLJh7Umzz/Yn7yOexavwn4grEQ6T0M12hk19IpisZ2zEDI16NCOZNzytX 2jYEnva4dC5fNGpa6Rf6uB6/z3PJycAAY1sGw5+2J663Z1Owd5O1yisbBHS2nO3Mgg9g PggTvgN0Lcc58OW7eW7M7bBYmahi67kle4ZFQ0CnWULr7SVsS6jVy2oDKE7bP3kZBtZx 0zeQ== X-Gm-Message-State: ABy/qLa/BqMuwvHbONDs4GHtm4CVq8lYvmU2ytsh4u7SpoabQPYg5TgE YF8NGUtftlqNOnquzzpeiERSnQG5GCP2ezCwngq0Bl+w3gzIj19S9mhLMVmU2yHpP03cUC6Ht42 8pE/bJtTmuTk= X-Received: by 2002:a5d:595b:0:b0:316:f3cf:6f12 with SMTP id e27-20020a5d595b000000b00316f3cf6f12mr4856145wri.48.1690989130093; Wed, 02 Aug 2023 08:12:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiwCmVukTG4b003Kw1jOw/WrbZSFH1/nxmUVT0cf0q5oxfG7XYzDO68q2V6Sj2RMU4SGVtAg== X-Received: by 2002:a5d:595b:0:b0:316:f3cf:6f12 with SMTP id e27-20020a5d595b000000b00316f3cf6f12mr4856114wri.48.1690989129710; Wed, 02 Aug 2023 08:12:09 -0700 (PDT) Received: from ?IPV6:2003:cb:c70b:e00:b8a4:8613:1529:1caf? (p200300cbc70b0e00b8a4861315291caf.dip0.t-ipconnect.de. [2003:cb:c70b:e00:b8a4:8613:1529:1caf]) by smtp.gmail.com with ESMTPSA id c18-20020a5d4f12000000b0030647449730sm19346391wru.74.2023.08.02.08.12.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Aug 2023 08:12:09 -0700 (PDT) Message-ID: Date: Wed, 2 Aug 2023 17:12:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 1/8] mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT To: Mel Gorman Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Linus Torvalds , liubo , Peter Xu , Matthew Wilcox , Hugh Dickins , Jason Gunthorpe , John Hubbard , Mel Gorman , Shuah Khan , Paolo Bonzini , stable@vger.kernel.org References: <20230801124844.278698-1-david@redhat.com> <20230801124844.278698-2-david@redhat.com> <20230802150816.aaubbx4t7745lqik@techsingularity.net> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230802150816.aaubbx4t7745lqik@techsingularity.net> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: DDFE92002A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: uyrozsysi7a5mcfnziujko4rzg6hnnw3 X-HE-Tag: 1690989436-423732 X-HE-Meta: U2FsdGVkX1/MTUGjzuLtczSD4C036R188TGqTIEorc4owq2zOpfbG/N/1qISZwysJuAbAM14+4RucUhe81fxgRed33id6oKtWX5P5JucI31u3+cnU33+3cFFrD9ak/5NUJ37ncvXu7Tn5Ui8zpx4ZJlUFVfknAkJIeTgtBu8+NT3n2lXZ5+rK+FLDlsmirIw/mGpemvI7hJAGnXYjYMPYGJMCGtFW9Ur/FzvhKu/okrkgxgF7XlxmuVQxF3icfJ8uUkJOAD6Fud2ArJ/kURKGR/LZ4ShkatwsZT8R8SJ4IKEh7bfScfraPzyKHAoGdehgQ0cG4SvBJJnkn0L/bUU1GtPNOkLWZMwzoiMczfHhPrRb7vs0GAveMSdKEZTjEEfYO1T10eR4Y+bKBqusOpJminIj8b2h8nSu2IH7VEHzFz7oRUEjJtTCWsc66anFeRzBDIv9e28rf68EjvrAbCoAVDnBKdiNlVpAKgjnzvb3ikzXD1wd+3gbqyi4I92GaVurVBD1VER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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: >> Reported-by: liubo >> Closes: https://lore.kernel.org/r/20230726073409.631838-1-liubo254@huawei.com >> Reported-by: Peter Xu >> Closes: https://lore.kernel.org/all/ZMKJjDaqZ7FW0jfe@x1n/ >> Fixes: 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()") >> Cc: >> Signed-off-by: David Hildenbrand > > I agree that FOLL_REMOTE probably needs separate treatment but also agree > that it's outside the context of this patch, particularly as a -stable > candidate so > > Acked-by: Mel Gorman > > I've a minor nit below that would be nice to get fixed up, but not > mandatory. Thanks Mel for taking a look, so I don't mess up once more :) > >> --- >> include/linux/mm.h | 21 +++++++++++++++------ >> include/linux/mm_types.h | 9 +++++++++ >> mm/gup.c | 29 +++++++++++++++++++++++------ >> mm/huge_memory.c | 2 +- >> 4 files changed, 48 insertions(+), 13 deletions(-) >> >> diff --git a/mm/gup.c b/mm/gup.c >> index 2493ffa10f4b..f463d3004ddc 100644 >> --- a/mm/gup.c >> +++ b/mm/gup.c >> @@ -2240,6 +2244,12 @@ static bool is_valid_gup_args(struct page **pages, int *locked, >> gup_flags |= FOLL_UNLOCKABLE; >> } >> >> + /* >> + * For now, always trigger NUMA hinting faults. Some GUP users like >> + * KVM really require it to benefit from autonuma. >> + */ >> + gup_flags |= FOLL_HONOR_NUMA_FAULT; >> + >> /* FOLL_GET and FOLL_PIN are mutually exclusive. */ >> if (WARN_ON_ONCE((gup_flags & (FOLL_PIN | FOLL_GET)) == >> (FOLL_PIN | FOLL_GET))) > > Expand on *why* KVM requires it even though I suspect this changes later > in the series. Maybe "Some GUP users like KVM require the hint to be as > the calling context of GUP is functionally similar to a memory reference > from task context"? It's raised later in this series but it doesn't hurt to discuss it here in a bit more detail. Sounds good to me. > > Also minor nit -- s/autonuma/NUMA Balancing/ or numab. autonuma refers to > a specific implementation of automatic balancing that operated similar to > khugepaged but not merged. If you grep for it, you'll find that autonuma > is only referenced in powerpc-specific code. It's not important these > days but very early on, it was very confusing if AutoNUMA was mentioned > when NUMAB was intended. Ah, yes, thanks. That's the one of the only place where that terminology accidentally slipped in. I'll wait for more feedback and resend! -- Cheers, David / dhildenb