Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1694010lqe; Mon, 8 Apr 2024 18:09:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWewElMrk0hKMFprGdHBmUXBjrpeL2Ut7Ngz2AL4sbfGDRpp0Emf8Bqnx1lLowQruWHOnv0ny3iu09TCUIjbju5L57X73qWx8KMI5wWmQ== X-Google-Smtp-Source: AGHT+IFCqODpuXR3wBuUgESWCwvRUHsvoFDJCErYMtxeIEZ38b9A762Nke5t6I8JsriEqsJPYX7w X-Received: by 2002:a05:6214:d66:b0:69b:aa6:4234 with SMTP id 6-20020a0562140d6600b0069b0aa64234mr8977710qvs.45.1712624975747; Mon, 08 Apr 2024 18:09:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712624975; cv=pass; d=google.com; s=arc-20160816; b=xtzHQUUBsvoOgu89GzTBPf1r93nLxbWTz0GS2C/qXsosbgAa/vKwOpNkpcXCqY7P6Q y8WPx4LmGQbg5Z6yY6d0ihRs0KGotG3DCekjRURrvS5WDYVTPCNUk+bHuNxAvDXC/Tw/ oCLygSV0exJuzdVK9VOwFFzA6T/qP1vWxINzhUacJt51RXzxs3qQfdnwjHLmGXYKaDOx Faiv1p4e6itcEths1K/BGocRl8azhnjO/NramDPuWxrw0NBvue+b/HkmMKxPDCuI1fQX qnHCUPvyJKz/P/ImjzJHqHenj7C58nfkQg96Jn9S+O81NtAPUr0re7WUDwmUBCvgctAX CzGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=/q/pS5VWmkgJoe/lbRAjXp5xkfsvBlP1onerHFpOBRU=; fh=+qzIEkhkwrXee0BpV9PWvxpl5LGnhj4DgYr18surU/o=; b=qpseBn6VIKaNSGDQsux+j8NDV6HdACuE5SwlQxdmohGN+56csvuquOVTYMmrJmWCH3 Zli5CwarM3XSw8nB60DqjIkZqyiry/9YP7szW512to7JYW37hTXE5JOtfvMJnO8AkZ8U JXHTKYQImD0Qo4icelptj63T0cXz0oeFSDxh6FGu8kb64T7TTzpXYgISqBCs4NvrFtvn 47+Dmk2uQGRbMyzAaWj2QOf1oPMVGoFRuMdX/+O4/+0fmTlC0k/GbmsEgMdZWILDEcr6 JgFX3pxo9zXf8TxtoxAf6ghAIraWIgs9wyZkFrQBVfDLRHCliC+hsJwC/TxqMAiSWGk3 Jo5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="UVZlvsS/"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-136062-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r15-20020ad4576f000000b0069b24143d24si1872413qvx.63.2024.04.08.18.09.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 18:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136062-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="UVZlvsS/"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-136062-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7A8F71C223C9 for ; Tue, 9 Apr 2024 01:09:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F7DDA951; Tue, 9 Apr 2024 01:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UVZlvsS/" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AFC8A934 for ; Tue, 9 Apr 2024 01:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712624969; cv=none; b=RVKVmT4bg8QnOqufutwv2LVpA0XJKHGc9carj77l3KWrpGqhz6ibE2EFG4r91X/W03nb5FoIubsuDg8Nr8zfsTHul0RZ5nha8HfcGwetKfXbPjuxCxjbnx/xpCQbvcUDvseAfI99bLn049IpsdgKVelIomhTdiDL415aD0BICjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712624969; c=relaxed/simple; bh=/8XqYJs3NAILkmaX8AcFbqEoJRh52nEXesKZfZMQ6UM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=r4M7wGCJfzJ1IumieI5hrHnN8fhPmk/Ceov4DlKZd2/UUCC0ZSfQhjbnVibiDU5c0vfVgV5PFYt2xsUDy5DlcCR98jhII6RhtXVeDUT4ZWjPoXAELWunZIUJCid7UN91pyw3A/WehSh3DeEsyId2MF8TWQSusQca1mKbk5HkC0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UVZlvsS/; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712624967; x=1744160967; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=/8XqYJs3NAILkmaX8AcFbqEoJRh52nEXesKZfZMQ6UM=; b=UVZlvsS/bcebWlR5iYIgsi8RYzcHtonNA1MsBEcpTvZAughMNu495MCc uIXStIu0ag3i1G5Ozo7QRYz2FmuhvyCtSqYogl3higumr6MRzooHcisnv 7TdAN5r0KbHLychd2uNtoya8hIdJeTUSbnnNrYQAmcXYUdD4a4TGLbilR iXQp1X1AXGq0VjRnZaIO/LDgzaCkS/avHCTENl0Ycra+5oaBNziip9A92 kXH8w0RVBccE3SBBFJEMIRYAI5BevGEpnbUMTeablW0iLyDAzOoThFkQw Fg1H7BgEhmn5mzagaFNpzaQgtwVlN/FCETDFPKFNoVd0e0UrvzfQrLjze g==; X-CSE-ConnectionGUID: WBXNJelTQlKohpUL+OFinQ== X-CSE-MsgGUID: vrTfeOuSRCauyQUgJhsMyQ== X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="18536397" X-IronPort-AV: E=Sophos;i="6.07,188,1708416000"; d="scan'208";a="18536397" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 18:09:25 -0700 X-CSE-ConnectionGUID: KMGnh2sQRMaZ4G8v/STDlw== X-CSE-MsgGUID: /DfFWl6KRmy60VIzxSDSGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,188,1708416000"; d="scan'208";a="20500770" Received: from unknown (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 18:09:23 -0700 From: "Huang, Ying" To: Andrew Morton Cc: Zhaoyu Liu , ryncsn@gmail.com, nphamcs@gmail.com, songmuchun@bytedance.com, david@redhat.com, chrisl@kernel.org, guo.ziliang@zte.com.cn, yosryahmed@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: swap: prejudgement swap_has_cache to avoid page allocation In-Reply-To: <20240408132704.f966adc8d3928df4d3b8c0a9@linux-foundation.org> (Andrew Morton's message of "Mon, 8 Apr 2024 13:27:04 -0700") References: <20240408121439.GA252652@bytedance> <20240408132704.f966adc8d3928df4d3b8c0a9@linux-foundation.org> Date: Tue, 09 Apr 2024 09:07:29 +0800 Message-ID: <87edbf8hta.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Andrew Morton writes: > On Mon, 8 Apr 2024 20:14:39 +0800 Zhaoyu Liu wrote: > >> Based on qemu arm64 - latest kernel + 100M memory + 1024M swapfile. >> Create 1G anon mmap and set it to shared, and has two processes >> randomly access the shared memory. When they are racing on swap cache, >> on average, each "alloc_pages_mpol + swapcache_prepare + folio_put" >> took about 1475 us. > > And what effect does this patch have upon the measured time? ANd upon > overall runtime? And the patch will cause increased lock contention, please test with more processes and perhaps HDD swap device too. >> So skip page allocation if SWAP_HAS_CACHE was set, just >> schedule_timeout_uninterruptible and continue to acquire page >> via filemap_get_folio() from swap cache, to speedup >> __read_swap_cache_async. -- Best Regards, Huang, Ying