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 2643EC4332F for ; Wed, 9 Feb 2022 15:38:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C7186B0074; Wed, 9 Feb 2022 10:38:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 34F806B0075; Wed, 9 Feb 2022 10:38:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21C0C6B0078; Wed, 9 Feb 2022 10:38:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 0FE266B0074 for ; Wed, 9 Feb 2022 10:38:05 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id D6C9C813A2 for ; Wed, 9 Feb 2022 15:38:04 +0000 (UTC) X-FDA: 79123647288.02.42B9581 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by imf09.hostedemail.com (Postfix) with ESMTP id 67E95140008 for ; Wed, 9 Feb 2022 15:38:04 +0000 (UTC) Received: by mail-qk1-f178.google.com with SMTP id w8so1890825qkw.8 for ; Wed, 09 Feb 2022 07:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=ZgbfcwbgPkpuM7mu7HCH+WaELpgN95UWkk6kyDoy9Hs=; b=aYR8VVj/esZ2WkexXOmm9y9DPE8VyMMI0FOey13akjZ1BkVAAuRt4xnBSn+lOfeYaU 8Jb1p4pmPSt4tUAnv0xHqvOL7Ek4nCzna8r4uyfTBwjSxCyfxBZt2gViR4RiUH6qPhVt HoCsE1LipfiY2VESbBTlg6frx3/isAyZhCerV41PfWTIyfaHT/CYFOzDlm7Pa19Ta7KM epC9+xEKe8YuGE5W85BpFvQXXyxI4b2CNSRKQ/sxn5XVv04evB9jcJd+WDbZDw2ZopbF KH7+e7ZbGjRCHocJyI6FAe28b4CzR5SNfMB1jUjMuMh1L1Zq06Tzka8OI+WYyDRFGpqT FMGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=ZgbfcwbgPkpuM7mu7HCH+WaELpgN95UWkk6kyDoy9Hs=; b=COunYzhTUGGFhA73vAEjB2V2PBUNDF3+m9kaNWQp6Lgdh0Fyk3AMnSnL7EhmnrY1B4 F1qvOqrhSHIiVSyEtdI/VLf/fnaO8eIXsyZaAJ3oBE+f7i/x4A/4Ilpo3XEJUzGa8Fpm vb4Nn8E3kChG+HwMN+edaplnKa84KqQ2Rr+VnDr9OplgKiJpdFp3Yik1lftwiYyyxavx GiTFZjRziO36UahZ+0cHy372PI+UJFt2Cj63GG3ExvQPgagqOjIxQmwrbmF91rjuybXp vWItmIu4vrBU5AUPPu41c1YrZy9qRW5HAIm2lE05jjNBBTT+44Z+Q/iB4uZRdDgJGlEf jaXw== X-Gm-Message-State: AOAM531zSWWh6iBItkN0rRZjei/peSaIL3c4oBbAxzllkFZjInHpQmlx H92kXxa62TL5YZMGTeEuWwZS7g== X-Google-Smtp-Source: ABdhPJzwtcw9nIRGIq1isTErfCEla/NZnsAxu9/ntX5lA3PPv7aS8xZYOD5xUEgmbMVV0UZcRK8THQ== X-Received: by 2002:a05:620a:2087:: with SMTP id e7mr1380444qka.554.1644421083468; Wed, 09 Feb 2022 07:38:03 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id n19sm8881100qkp.52.2022.02.09.07.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 07:38:02 -0800 (PST) Date: Wed, 9 Feb 2022 07:37:50 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: SeongJae Park cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, hughd@google.com, geert@linux-m68k.org Subject: Re: [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU In-Reply-To: <20220209094158.21941-2-sj@kernel.org> Message-ID: <715a8b2e-1048-c098-8b89-bcf3c13cbd75@google.com> References: <20220209094158.21941-1-sj@kernel.org> <20220209094158.21941-2-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="aYR8VVj/"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of hughd@google.com designates 209.85.222.178 as permitted sender) smtp.mailfrom=hughd@google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 67E95140008 X-Stat-Signature: 4cj4s5gu3s98kj3979i87its8kwo96gi X-HE-Tag: 1644421084-567757 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, 9 Feb 2022, SeongJae Park wrote: > Commit 4b3b8bd6c8287 ("mm/munlock: mlock_page() munlock_page() batch by > pagevec") in -mm tree[1] implements 'mlock_page_drain()' under > CONFIG_MMU only, but the function is used by 'lru_add_drain_cpu()', > which defined outside of CONFIG_MMU. As a result, below build error > occurs. > > /linux/mm/swap.c: In function 'lru_add_drain_cpu': > /linux/mm/swap.c:637:2: error: implicit declaration of function 'mlock_page_drain' [-Werror=implicit-function-declaration] > 637 | mlock_page_drain(cpu); > | ^~~~~~~~~~~~~~~~ > cc1: some warnings being treated as errors > /linux/scripts/Makefile.build:289: recipe for target 'mm/swap.o' failed > > This commit fixes it by implementing no-op 'mlock_page_drain()' for > !CONFIG_MMU case, similar to 'mlock_new_page()'. > > [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch > > Signed-off-by: SeongJae Park > --- > mm/internal.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/internal.h b/mm/internal.h > index 0d240e876831..248224369b34 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -508,6 +508,7 @@ static inline void mlock_vma_page(struct page *page, > static inline void munlock_vma_page(struct page *page, > struct vm_area_struct *vma, bool compound) { } > static inline void mlock_new_page(struct page *page) { } > +static inline void mlock_page_drain(int cpu) { } > static inline void vunmap_range_noflush(unsigned long start, unsigned long end) > { > } Thank you, SeongJae, and thank you Geert for reporting. This patch is good as far as it goes, but Andrew, please don't add it right now: I need to think a bit more, and will send another (or Ack SeongJae's) later in the day. The thing is, SeongJae's patch makes me wonder, why did it not need a !CONFIG_MMU definition for need_mlock_page_drain() too? That's because mm/swap.c's call to it is under an #ifdef CONFIG_SMP, and I imagine that CONFIG_MMU=n usually goes along with (but does not necessarily imply?) CONFIG_SMP=n. It'll be safer to add a need_mlock_page_drain() stub too. But more seriously, is the mlock_page_drain() going to be called when it's wanted, when CONFIG_SMP is not set? I had forgotten how mm/swap.c goes in different directions (for some things but not for others) according to CONFIG_SMP. I'll look into it and come back later. Thanks, Hugh