Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp529230pxb; Wed, 14 Apr 2021 23:47:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdDH2p4/GEP/feWkY3kRu57wJuhjy4LIWEBAvCOkYDRdeYwpZ2tBeCtrvH6Yc8LuuCu35b X-Received: by 2002:a17:90a:8914:: with SMTP id u20mr2182012pjn.90.1618469258731; Wed, 14 Apr 2021 23:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618469258; cv=none; d=google.com; s=arc-20160816; b=NWou55O8tx0Zw375vuhxIxy5lpgyJ1WRTWFauaoe5oRLlWh30Y3JnJ2htb6JerDDMK hURFuyDpaILVIKK+szqLvUVQUgLwn4lDoQX72jD9GuTkZuadh0bvJhnfIsTtX+s4X9w9 arax64jTGbmeNrKOP/IrxNcR5l/uGpIZuc0i7MnPYf1xl8RYOCitj/APBjrz2csj8oIa pfB53STy6P+0wr8Uq2utCJDKEj62vEIrEo0oQUQdQajRoeRATgO2mAysteDZGLQfIXt3 w3OC2jW28K5oV5wbWziTESXymCvZqF/4Nxsln7RZLciGn7EuX7aJjQfgfY5/Eyyupbjv fwtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=rLzrjyAoXweoY6U+g74kIGy+GkSylXBdk+diwwcYYuM=; b=IOUZ2obRRUgvLkhBeD6PAyp+Zn10qOr1JHDkdHVvi8fKh+NvkiItkhn6uxSvLVhNSs jSLjAfLrLgu2sx3171mBCDn+Mcl6gpSO5VT2pNpDzSyZcAn6nbTzPtgYgf6ueE4qycBa VlNXsCmA0vHHL+xKrRk0beDfE6CGM+OgXbaGnzSS5YGRAloBjLLqNtfE2JVo0boeY9NS Cgh4SkNfPhBVKAoR9NOQYBAxOkpW/d+C1vt1SFKpHHu6b+RtGi3N8oo8242QtBCP6EC4 9z5OPL+spGTG8YRuR7TVlKa3NKNbZFeIySijvat2YH/PL+mZwJGP5Ij6trroze7IFiUS AW0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ls12si2178283pjb.101.2021.04.14.23.47.26; Wed, 14 Apr 2021 23:47:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbhDOGq3 (ORCPT + 99 others); Thu, 15 Apr 2021 02:46:29 -0400 Received: from mga11.intel.com ([192.55.52.93]:21856 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbhDOGq2 (ORCPT ); Thu, 15 Apr 2021 02:46:28 -0400 IronPort-SDR: qXA0Cy5Sxat0HlfJSXHh9gid2sfZE9wDO326BmQtwTQB+2Q+8CbzsinEgj5BrSrTPUQg8OT5b6 N9jAMKFK1F9g== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="191609700" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="191609700" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 23:46:02 -0700 IronPort-SDR: 1pfPbXhjlYYReGkPxq6HfP4+S3mzqWZg9G55ESeGOM9vhqkGCJ7BYRc35RiXXmWynnugSAJ6uM atnC5MlIfazg== X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="425061751" Received: from yhuang6-desk1.sh.intel.com (HELO yhuang6-desk1.ccr.corp.intel.com) ([10.239.13.1]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 23:45:58 -0700 From: "Huang, Ying" To: "Zi Yan" Cc: Yang Shi , , , , , , , , , , , , Subject: Re: [v2 PATCH 6/7] mm: migrate: check mapcount for THP instead of ref count References: <20210413212416.3273-1-shy828301@gmail.com> <20210413212416.3273-7-shy828301@gmail.com> <87k0p5sh7h.fsf@yhuang6-desk1.ccr.corp.intel.com> <6297AD92-8D0E-4BEC-8E1F-5C5AC32FA128@nvidia.com> Date: Thu, 15 Apr 2021 14:45:54 +0800 In-Reply-To: <6297AD92-8D0E-4BEC-8E1F-5C5AC32FA128@nvidia.com> (Zi Yan's message of "Wed, 14 Apr 2021 11:02:58 -0400") Message-ID: <87fszsoxjx.fsf@yhuang6-desk1.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Zi Yan" writes: > On 13 Apr 2021, at 23:00, Huang, Ying wrote: > >> Yang Shi writes: >> >>> The generic migration path will check refcount, so no need check refcount here. >>> But the old code actually prevents from migrating shared THP (mapped by multiple >>> processes), so bail out early if mapcount is > 1 to keep the behavior. >> >> What prevents us from migrating shared THP? If no, why not just remove >> the old refcount checking? > > If two or more processes are in different NUMA nodes, a THP shared by them can be > migrated back and forth between NUMA nodes, which is quite costly. Unless we have > a better way of figuring out a good location for such pages to reduce the number > of migration, it might be better not to move them, right? > Some mechanism has been provided in should_numa_migrate_memory() to identify the shared pages from the private pages. Do you find it doesn't work well in some situations? The multiple threads in one process which run on different NUMA nodes may share pages too. So it isn't a good solution to exclude pages shared by multiple processes. Best Regards, Huang, Ying