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 8FBDEC54E5D for ; Wed, 13 Mar 2024 01:36:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 032E38E002F; Tue, 12 Mar 2024 21:36:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F239C8E0011; Tue, 12 Mar 2024 21:36:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E132A8E002F; Tue, 12 Mar 2024 21:36:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D25088E0011 for ; Tue, 12 Mar 2024 21:36:30 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7FC54A0E06 for ; Wed, 13 Mar 2024 01:36:30 +0000 (UTC) X-FDA: 81890300940.29.FEF0110 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by imf30.hostedemail.com (Postfix) with ESMTP id A4CD18000E for ; Wed, 13 Mar 2024 01:36:28 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ed7pT74X; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf30.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710293788; 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=G0q5hTKEQWEn/SqpXIFZS+lXVChINQM9nXMLkHonJO8=; b=a7W+6mvGQmNbIWSnpmSGCYqtmydhFiXwttgFybxLPfwgsGShMQObywuLWFWRjY0iut1syt zYtASnmt8qEaqJA7QQduFmeJir/5cvvj2t7ALw1P2KALndRhUqDcBjl3HnCxMwR8c19nto bW7kjpuVYJWP6t6niCMAg+VL5RgIlkQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ed7pT74X; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf30.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710293788; a=rsa-sha256; cv=none; b=jvuenEquFsX8IHrdNns6RTCzedDURhMz0OknEp1IwkpHhPkZOFvyJbOt/buwquXdvRWc2J LSicbanKRbneGDoV+Tg+CBF/9EEXYANEFJ5aQVDlsROmlIJVo0xVyrc0rEZxzV6YFYt4OC LHvXwxD/GC70LaH/osn0fGQtRUx24v8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710293789; x=1741829789; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=oFDwWocpbPxkR5yivk+zblxm9GFLekim2vygWThKv48=; b=ed7pT74XX86OK/mvlaxW/unFeq8XVlWSujhuo7U0NsOp9zXMfjBHrES6 knJ5pLjC4+l0uaN+42rxoBMVcA5S+SVI9ajQyNmtfdEAwVeirxScCLuYO tWNXdhFckANc8jzRbNgzbaebInBGZ+/Mh6HSruqyq67xddOosjbGNGCI6 qdhq+HS9qJbol/BCf7zy0tqWDVYfuGP5bUhAv4gJ8WdVK4g3y7e8sNp8I 5gUfh5A+vj1WamX3AGamWPyrTmP7TIFiiSxrr99RDmEZFR7bOjkcuS+7O 6rTe+OaGzUPuoxvMP3Xa4YLkLKHhITsJkWxRN3WNbBGv0vJPaHH4+KJH/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11011"; a="22491014" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="22491014" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 18:36:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="12196777" Received: from yhuang6-desk2.sh.intel.com (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; 12 Mar 2024 18:36:24 -0700 From: "Huang, Ying" To: Ryan Roberts Cc: Andrew Morton , David Hildenbrand , Matthew Wilcox , Gao Xiang , Yu Zhao , Yang Shi , Michal Hocko , Kefeng Wang , Barry Song <21cnbao@gmail.com>, Chris Li , , Subject: Re: [PATCH v4 3/6] mm: swap: Simplify struct percpu_cluster In-Reply-To: <2e236d6b-e6fc-428a-ad06-c2fb1dbf5c8b@arm.com> (Ryan Roberts's message of "Tue, 12 Mar 2024 08:51:23 +0000") References: <20240311150058.1122862-1-ryan.roberts@arm.com> <20240311150058.1122862-4-ryan.roberts@arm.com> <87cyrz51lj.fsf@yhuang6-desk2.ccr.corp.intel.com> <2e236d6b-e6fc-428a-ad06-c2fb1dbf5c8b@arm.com> Date: Wed, 13 Mar 2024 09:34:29 +0800 Message-ID: <87r0ge3oey.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Queue-Id: A4CD18000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: atwr181nmgxiogbto5wt4tewe7tz5dww X-HE-Tag: 1710293788-778869 X-HE-Meta: U2FsdGVkX1+YdHUxqHG3b8WyMwwH948ew9TNBRi1SRY9xsKeRJXFa5dgJhqajGkmHPJuRcSH6CEh6lUCEZpmkHR2sX57wgviV0fOzyFZM6AGtiLGibLe1DCBeHr9b/zaad3gJe42GDfzpMt0Xc3/qznLXzEYZZgBEhlN0wllpVsSxYfluZYrjKAsmt4ylbXeHxoyp+wqPAeeEXfeHSp+r97fxALuLJViW2TWdoBppP6hNAhJuEARQ/6ga9iPI84ywJ/KGug2Az6DU79SKYn4d6601+aaSb81y9e5f+DBJVojl0FZok4sssE2QeeMyfr+C+pwYZkdCOcWk2teRjaE1Ar5id8Z1HMr8NSDZaKQoM2JitzL6abmFdzegkeFnVMNNRRPlex11+nEnIsqk8ldxKmoYBYFwq1i5NCMo6zGLBsqIImQ5jCsr9xJ5K7j+h+QWY27s4PYCbiY9C3SO05IbUj9sa00RA1mdnMB2bn9zZ02kKHfXeCeoRhfbBMUIdsNk5ldQsrw2DJk2ZBHmEaZyNXnYB60LadYzNa1LH/Q3XHSi0nOHarqByg74T3ZIKfuU73l4V/0YVrmgG8KdzVYxY47v6VrGce2Jki0JMIS+edTRF3lMBVkcqBEAO2kPBJbTJRJU5bfkfQHCYE9ugLUlIoQtMjFvr2bFKhM1K4S7AzlrnPS5iqPIvrPQuFuwSLQLVGVW2/i9tmtn3JBScJ8rrXnMGnRaQM/PpUOcTQ6kR4LaewrQV4UVg85tkkLD2qJb+p5LGC/d4/hVpwySI0G9lse2NH+s5iu4sdascVn1u5DnpqNfvNk4XUatdgcA8IOjmmpuHJJtSE5pplYE3q8D4hsrQmciJ2oJMfZ0ORmtwkBwiNX7rosb76tiFBDMIAOevDpuHlpXZ4= 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: Ryan Roberts writes: > On 12/03/2024 07:52, Huang, Ying wrote: >> Ryan Roberts writes: >> >>> struct percpu_cluster stores the index of cpu's current cluster and the >>> offset of the next entry that will be allocated for the cpu. These two >>> pieces of information are redundant because the cluster index is just >>> (offset / SWAPFILE_CLUSTER). The only reason for explicitly keeping the >>> cluster index is because the structure used for it also has a flag to >>> indicate "no cluster". However this data structure also contains a spin >>> lock, which is never used in this context, as a side effect the code >>> copies the spinlock_t structure, which is questionable coding practice >>> in my view. >>> >>> So let's clean this up and store only the next offset, and use a >>> sentinal value (SWAP_NEXT_INVALID) to indicate "no cluster". >>> SWAP_NEXT_INVALID is chosen to be 0, because 0 will never be seen >>> legitimately; The first page in the swap file is the swap header, which >>> is always marked bad to prevent it from being allocated as an entry. >>> This also prevents the cluster to which it belongs being marked free, so >>> it will never appear on the free list. >>> >>> This change saves 16 bytes per cpu. And given we are shortly going to >>> extend this mechanism to be per-cpu-AND-per-order, we will end up saving >>> 16 * 9 = 144 bytes per cpu, which adds up if you have 256 cpus in the >>> system. >>> >>> Signed-off-by: Ryan Roberts >> >> LGTM, Thanks! > > Thanks! What's a guy got to do to get Rb or Ack? :) Feel free to add Reviewed-by: "Huang, Ying" in the future version. -- Best Regards, Huang, Ying