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 C63ADC27C4F for ; Sun, 30 Jun 2024 15:05:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA6886B0088; Sun, 30 Jun 2024 11:05:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D56216B0089; Sun, 30 Jun 2024 11:05:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF6FA6B0092; Sun, 30 Jun 2024 11:05:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A0E586B0088 for ; Sun, 30 Jun 2024 11:05:44 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1ADF51C18FC for ; Sun, 30 Jun 2024 15:05:44 +0000 (UTC) X-FDA: 82287879408.30.4E0810A Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by imf05.hostedemail.com (Postfix) with ESMTP id 2E218100029 for ; Sun, 30 Jun 2024 15:05:41 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iYKCGWd2; spf=pass (imf05.hostedemail.com: domain of yunshenglin0825@gmail.com designates 209.85.166.194 as permitted sender) smtp.mailfrom=yunshenglin0825@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719759914; 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=8pW+jLLcRjyIRN35ybG3Xi0qa84JdPP0aoNcuOxSBAw=; b=DjXlm1vurLr4+ljl/BZ/VAYNbPl/lKFfRX1/L07WBse2LUU8FFGCLtnjgLnOdiOYQ/+RCi zeynUnNAOSz60F+rIPlgxtj2CpJqXTeBoIyayLebZC10WbhnDWDoSLt0x/i1PuDXamlzUc umC2oZ4W8j2tNnle8SboUFUMdB+hgkE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iYKCGWd2; spf=pass (imf05.hostedemail.com: domain of yunshenglin0825@gmail.com designates 209.85.166.194 as permitted sender) smtp.mailfrom=yunshenglin0825@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719759914; a=rsa-sha256; cv=none; b=xk/SPjTD32GbxHBFVlPJn1xnAFn5ShVakJ9mu8oXGuyF+PjpHCVPBwKiM4oNUyOl4CWjiR XgESiZNUvL7F8J4gvlnSf1umGEWmisWQ5jI249X+iFNgGveaBBETRdelWKHA2UC5XXX6kk 7F7ExctxDKPLghpvx037GUwSQw3H9Ts= Received: by mail-il1-f194.google.com with SMTP id e9e14a558f8ab-36dd56cf5f5so9483375ab.3 for ; Sun, 30 Jun 2024 08:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719759941; x=1720364741; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=8pW+jLLcRjyIRN35ybG3Xi0qa84JdPP0aoNcuOxSBAw=; b=iYKCGWd2iRlcxHzNAfQMoMvQSoc6BphwFUEpVPP8S2TcHapc2Ximarawz03ipKzptN QcOEPAaiyh9xmMnY3o6Q+BfPAhXd7zL+KMFNb6wM6B9zuszvWKKtVkEdga3lsxFbRvGP j6S5lJfiZcWdA3yU8urlYGS9+tuT89UgmVfqEzCSxFzvelj8/DaBwNIKn31Hoa4lEbhb CKWrC/1RmB3bzUt5lw56nF2WWtTvQ+2angVdVTradtTD5vGqncP5TMCy7axkMxoZBuCF 5JW4GzfLp4sZJvNZeZQGTY16M6JhfEDb/ZuA76BapxJmvh02ur/sMVGN53E+9EpVT0as NH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719759941; x=1720364741; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8pW+jLLcRjyIRN35ybG3Xi0qa84JdPP0aoNcuOxSBAw=; b=SDEW0J6NG5W9JXD2LLo9Ku1Up25GYMyel95VoGlPLujQkjVtu/DTM0onxLq7wNOgGL YFtBuptaMM0KUqvIIo6cFOnd5D12mUsLFiAI65j/HwykwKhuC+vQjmeDh/s0NbX49ABO +DZJ9g0p7XE0qdYgtLT6sEPO6XIzJLY4L68xN1iwLBK6d+KAeN+r3n/kjBdymf/DzC9o 1Eu9wBB6KxwjHxsDhT5zu4Kd0f+z6qbKzcSYYymh+bHYnXKuA6DJIAHVLZX1cWbUkqEM 1W7qbXPwTTBj4Vpab3dYT7mlFIphpANqwYQleWn1N551G28MPMzV0hNFnjYl8htC1iAp a/Qg== X-Forwarded-Encrypted: i=1; AJvYcCUqdTMgTZVHjxWs7CSnSoD1GRFq99+SkjMqLjAm+kpktGwfTzJyZtgcDABTUoDNPMw9SlZA3MiZOmYZQLq+UUuR7j8= X-Gm-Message-State: AOJu0YzjquX0zarTl5NdR5SV4+tM4LoirwRku21BmLl+6jUpcZoQ2Re3 tIUzFQT0W/TFqfYsvrBFQ2UxKuA/jiQTtcL6sWNmsA4jOR8E1Sm3 X-Google-Smtp-Source: AGHT+IHwHse3in2PkiQPU0Xyop/sYo1K4tQUV+09TypRGky1b2Wvq0lTqu+sx/7oBcNPcDVIxVvMAw== X-Received: by 2002:a05:6e02:2168:b0:374:a176:e26e with SMTP id e9e14a558f8ab-37cd3498a70mr33419805ab.31.1719759941163; Sun, 30 Jun 2024 08:05:41 -0700 (PDT) Received: from ?IPV6:2409:8a55:301b:e120:19b7:87b2:860d:6c8d? ([2409:8a55:301b:e120:19b7:87b2:860d:6c8d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-708044ac419sm4779020b3a.164.2024.06.30.08.05.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 30 Jun 2024 08:05:40 -0700 (PDT) Message-ID: <15623dac-9358-4597-b3ee-3694a5956920@gmail.com> Date: Sun, 30 Jun 2024 23:05:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v9 10/13] mm: page_frag: introduce prepare/probe/commit API To: Alexander Duyck Cc: Yunsheng Lin , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org References: <20240625135216.47007-1-linyunsheng@huawei.com> <20240625135216.47007-11-linyunsheng@huawei.com> <33c3c7fc00d2385e741dc6c9be0eade26c30bd12.camel@gmail.com> <38da183b-92ba-ce9d-5472-def199854563@huawei.com> <0a80e362-1eb7-40b0-b1b9-07ec5a6506ea@gmail.com> From: Yunsheng Lin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2E218100029 X-Stat-Signature: fnttu4hhro8xyqxbza4okj4x4p98w343 X-Rspam-User: X-HE-Tag: 1719759941-764175 X-HE-Meta: U2FsdGVkX199BwwoPP4C/44O8aFDKYv0dDlYqUd6SrdULDJLO4ybL+D9msbzemavZSJApC1B+53/st1p4xpNfrZR6A2kCWiJsq98kDadpCrDT33v9xJrY/I9/vUoqmjudQaCqto7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AoYN6kb94YaBIQoGjU1R3o+XQXdqGxfKZzh9jER1Ye7aMpsrc4tRnzgCV1YBQQgmXBgl1pb9N7FVvnRXvOYMIPexR0vSN1qOKR+HhaBVf5o1V2v2U4mlfBRinbiw3dNQ1zlK8HhhWLfXFIUwQ9hEef25as3oNi0zVB5IDMGSc1z4O3YrU3e95sXstElqOClzDYklKPGeglLCW9MKcBTHOt2xc1tUYY9UAPfsogqJC6Iv5ed1aOHeKTh7uvMpl4XTIdQpnqZj2J0SwMMJsC80YTknzIJ24Ldal2semczvRfNWmOGnBvEZJGQbdw5Lcnd8ogVw8H7xByFdpC57iuAyGD8KRNI6/Pd+bjJir7mxgqk2bsCu6/yfOaRTG6mCA580TjvVK+r/GxUyvOmhchHPcmy6xiB0OOJP+0bctlBrY+lTafiNIyM8QZntUKRz/eYN5REovbwUKvchwWVQ== 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: List-Subscribe: List-Unsubscribe: On 6/30/2024 10:35 PM, Alexander Duyck wrote: > On Sun, Jun 30, 2024 at 7:05 AM Yunsheng Lin wrote: >> >> On 6/30/2024 1:37 AM, Alexander Duyck wrote: >>> On Sat, Jun 29, 2024 at 4:15 AM Yunsheng Lin wrote: >> >> ... >> >>>>> >>>>> Why is this a macro instead of just being an inline? Are you trying to >>>>> avoid having to include a header due to the virt_to_page? >>>> >>>> Yes, you are right. > > ... > >>> I am pretty sure you just need to add: >>> #include >> >> I am supposing you mean adding the above to page_frag_cache.h, right? >> >> It seems thing is more complicated for SPARSEMEM_VMEMMAP case, as it >> needs the declaration of 'vmemmap'(some arch defines it as a pointer >> variable while some arch defines it as a macro) and the definition of >> 'struct page' for '(vmemmap + (pfn))' operation. >> >> Adding below for 'vmemmap' and 'struct page' seems to have some compiler >> error caused by interdependence between linux/mm_types.h and asm/pgtable.h: >> #include >> #include >> > > Maybe you should just include linux/mm.h as that should have all the > necessary includes to handle these cases. In any case though it Including linux/mm.h seems to have similar compiler error, just the interdependence is between linux/mm_types.h and linux/mm.h now. As below, linux/mmap_lock.h obviously need the definition of 'struct mm_struct' from linux/mm_types.h, and linux/mm_types.h has some a long dependency of linux/mm.h starting from linux/uprobes.h if we add '#include ' in linux/page_frag_cache.h: In file included from ./include/linux/mm.h:16, from ./include/linux/page_frag_cache.h:6, from ./include/linux/sched.h:49, from ./include/linux/percpu.h:13, from ./arch/x86/include/asm/msr.h:15, from ./arch/x86/include/asm/tsc.h:10, from ./arch/x86/include/asm/timex.h:6, from ./include/linux/timex.h:67, from ./include/linux/time32.h:13, from ./include/linux/time.h:60, from ./include/linux/jiffies.h:10, from ./include/linux/ktime.h:25, from ./include/linux/timer.h:6, from ./include/linux/workqueue.h:9, from ./include/linux/srcu.h:21, from ./include/linux/notifier.h:16, from ./arch/x86/include/asm/uprobes.h:13, from ./include/linux/uprobes.h:49, from ./include/linux/mm_types.h:16, from ./include/linux/mmzone.h:22, from ./include/linux/gfp.h:7, from ./include/linux/slab.h:16, from ./include/linux/crypto.h:17, from arch/x86/kernel/asm-offsets.c:9: ./include/linux/mmap_lock.h: In function ‘mmap_assert_locked’: ./include/linux/mmap_lock.h:65:30: error: invalid use of undefined type ‘const struct mm_struct’ 65 | rwsem_assert_held(&mm->mmap_lock); | ^~ > doesn't make any sense to have a define in one include that expects > the user to then figure out what other headers to include in order to > make the define work they should be included in the header itself to > avoid any sort of weird dependencies. Perhaps there are some season why there are two headers for the mm subsystem, linux/mm_types.h and linux/mm.h? And .h file is supposed to include the linux/mm_types.h while .c file is supposed to include the linux/mm.h? If the above is correct, it seems the above rule is broked by including linux/mm.h in linux/page_frag_cache.h.