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 0B1FBCD98F3 for ; Wed, 11 Oct 2023 05:58:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73C848D0028; Wed, 11 Oct 2023 01:58:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6ECFA8D0002; Wed, 11 Oct 2023 01:58:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DB898D0028; Wed, 11 Oct 2023 01:58:16 -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 4F1E38D0002 for ; Wed, 11 Oct 2023 01:58:16 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 171B812013E for ; Wed, 11 Oct 2023 05:58:16 +0000 (UTC) X-FDA: 81332125392.10.3F3724F Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by imf11.hostedemail.com (Postfix) with ESMTP id 492744000C for ; Wed, 11 Oct 2023 05:58:11 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lKBZjVER; spf=pass (imf11.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697003894; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2pUFbEHCVYO0M18rSwontdPmUZzhiTCyMoqtFCxx6sY=; b=yWCSBWymnPzqikWwi/h02XRm6vBPXjTUcDN+cJo8gKfPOyCCIBSOLeevsT1FigjRlkcV+A iiit0BoDwk3EQ0U1xa7jjzXZy3z3EEeqEQdU8SK9r8adndE2PwOwXADNcXnoFVRSNwC8P9 mIMkmi9b6PD5gJabh0qSsdbV3RRLC18= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697003894; a=rsa-sha256; cv=none; b=2E/YE1YKb6rSlk3VjCPmJlQGmsfDRkNr9Egrq7N63MJ07p2QRB/Y8n4eVXo+cMigayNjos G/hZI4lWTLgujxne75KBb1Ydol5poWg8kW4ByIt1Ky20lCtwze5Rs/wAcMEq9fWTwdyh6m oOUc4usJk6ipkpEwjU83bhkWUY4XXrg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lKBZjVER; spf=pass (imf11.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697003892; x=1728539892; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=YahCY+6RxGW3/ZhuVqv5IVUbfCdBvQEtjngAOeCRTzU=; b=lKBZjVERFwxVYGbcxedQeHSr/dDoUaMlOEjGhtmjlyd6DFgv8R0sXP7R SM8yaukrFHth1TulNBwq87aoiH1+tDOPoWn+ocaF/87gQqJoJ0NqcQjkO igmknsVrPldwxUj510h2DS9ifw9PgeAThtGTcw1xFl1PCbkMJmqm96OaT pxBxOhBMpG/DaBOSOE6pRAip/a01Eo7uP1kBIFpPwUhbbw+NasrKni7lg czt/oH9gRBuBTluPpEy//PAAfjQEPD7fo8D0I2aL3EjiGpqhAUWOK10at fLxA+IxtXdUW3tNGbkiEKJyFH1FGV3k0M/0k9ibMMOx5Dr5sgG4CYMZ5D A==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="451079945" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="451079945" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2023 22:57:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="1000977399" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="1000977399" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2023 22:57:12 -0700 From: "Huang, Ying" To: Kefeng Wang , Matthew Wilcox Cc: Andrew Morton , , , , Zi Yan , Mel Gorman Subject: Re: [PATCH -next 1/7] mm_types: add _last_cpupid into folio References: <20231010064544.4162286-1-wangkefeng.wang@huawei.com> <20231010064544.4162286-2-wangkefeng.wang@huawei.com> <3b56b26b-a550-4e06-b355-55564b40cfb5@huawei.com> Date: Wed, 11 Oct 2023 13:55:05 +0800 In-Reply-To: <3b56b26b-a550-4e06-b355-55564b40cfb5@huawei.com> (Kefeng Wang's message of "Wed, 11 Oct 2023 11:02:13 +0800") Message-ID: <874jixhfeu.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Queue-Id: 492744000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 1txiprkobbro66dndd61rtubsooz67ud X-HE-Tag: 1697003891-888429 X-HE-Meta: U2FsdGVkX19/9ld50+BL4VUU/R43midWGEWaeYyobsP5dLii7Sfubf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uj22tJR7z7Podw3l+WhubqITUVtlnBxiJwB2n/ppEmjag6svziQHyA5/7i85AXRg5U2Ae3IIVI/OwM3mUkOfs 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: Kefeng Wang writes: > On 2023/10/10 20:33, Matthew Wilcox wrote: >> On Tue, Oct 10, 2023 at 02:45:38PM +0800, Kefeng Wang wrote: >>> At present, only arc/sparc/m68k define WANT_PAGE_VIRTUAL, both of >>> them don't support numa balancing, and the page struct is aligned >>> to _struct_page_alignment, it is safe to move _last_cpupid before >>> 'virtual' in page, meanwhile, add it into folio, which make us to >>> use folio->_last_cpupid directly. >> What do you mean by "safe"? I think you mean "Does not increase the >> size of struct page", but if that is what you mean, why not just say so? >> If there's something else you mean, please explain. > > Don't increase size of struct page and don't impact the real order of > struct page as the above three archs without numa balancing support. > >> In any event, I'd like to see some reasoning that _last_cpupid is >> actually >> information which is logically maintained on a per-allocation basis, >> not a per-page basis (I think this is true, but I honestly don't know) > > The _last_cpupid is updated in should_numa_migrate_memory() from numa > fault(do_numa_page, and do_huge_pmd_numa_page), it is per-page(normal > page and PMD-mapped page). Maybe I misunderstand your mean, please > correct me. Because PTE mapped THP will not be migrated according to comments and folio_test_large() test in do_numa_page(). Only _last_cpuid of the head page will be used (that is, on per-allocation basis). Although in change_pte_range() in mprotect.c, _last_cpuid of tail pages may be changed, they are not used actually. All in all, _last_cpuid is on per-allocation basis for now. In the future, it's hard to say. PTE-mapped THPs or large folios give us an opportunity to check whether the different parts of a folio are accessed by multiple sockets, so that we should split the folio. But this is just some possibility in the future. -- Best Regards, Huang, Ying