From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lgeamrelo03.lge.com (lgeamrelo03.lge.com [156.147.51.102]) (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 5ABB337BE8B for ; Thu, 29 Jan 2026 08:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.147.51.102 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769675327; cv=none; b=UUfQgHi0Z11Az3KIXV4ARwpOHWCVr8guTS3asDurvN2kQbW885at+XgKldr9M+z39nMtL4JEsnhETHpKMwvHyuLcDoSeG7Nu+UvSd3x0773e8RGSSF74ikjyt5LTJwJ7SEkframkwOlNbAzlk12ZA3J/jw2ttV6eyyU6jzvPiLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769675327; c=relaxed/simple; bh=Xp+vbo5GmWSQJhMNHrBuObAFVFzy8lTxxTJKZJ6F3WE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lHrPUj1Tt85BLMDMqmjzNuVvtlQLI77/lQgfhCr5wXFntNdwB3yMjPXmSU8y+Wn677kjrNm2im2xCund467JLiZ0Qrx90D+J0ZekrTZ/ve0KJd+f34BffS6Nl8p4OyXyd4tVAk1rpCXufJM9ZYrxY+nsqzQ77EtjQX98FnWlxUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com; spf=pass smtp.mailfrom=lge.com; arc=none smtp.client-ip=156.147.51.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lge.com Received: from unknown (HELO yjaykim-PowerEdge-T330) (10.177.112.156) by 156.147.51.102 with ESMTP; 29 Jan 2026 17:28:38 +0900 X-Original-SENDERIP: 10.177.112.156 X-Original-MAILFROM: youngjun.park@lge.com Date: Thu, 29 Jan 2026 17:28:38 +0900 From: YoungJun Park To: Kairui Song Cc: linux-mm@kvack.org, Andrew Morton , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Johannes Weiner , David Hildenbrand , Lorenzo Stoakes , linux-kernel@vger.kernel.org, Chris Li , Kairui Song Subject: Re: [PATCH v2 09/12] mm, swap: use the swap table to track the swap count Message-ID: References: <20260128-swap-table-p3-v2-0-fe0b67ef0215@tencent.com> <20260128-swap-table-p3-v2-9-fe0b67ef0215@tencent.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260128-swap-table-p3-v2-9-fe0b67ef0215@tencent.com> On Wed, Jan 28, 2026 at 05:28:33PM +0800, Kairui Song wrote: > From: Kairui Song > index bfafa637c458..751430e2d2a5 100644 > --- a/mm/swap.h > +++ b/mm/swap.h > @@ -37,6 +37,7 @@ struct swap_cluster_info { > u8 flags; > u8 order; > atomic_long_t __rcu *table; /* Swap table entries, see mm/swap_table.h */ > + unsigned long *extend_table; /* For large swap count, protected by ci->lock */ I assume using 'int *' is to save memory on 64-bit architectures (8 bytes -> 4 bytes per entry), which aligns with swp_tb_get_count() returning an int. Regarding the extended reference table. While I agree that a simple array is better for speed, readability and so on, the 2KB overhead (assuming SWAPFILE_CLUSTER=256) might be significant in constrained environments when only a few entries overflow SWP_TB_COUNT_MAX. Have you considered using a resizable hash table(example. or something others) instead? I am curious if this approach could be applicable as a future optimization after the current code is merged. Thanks :) Youngjun Park