Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp83330lqg; Wed, 10 Apr 2024 16:38:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXEBb3yG2RTFYmse8Aii0BigXjkfGCZqeRUJ9Q6BiBDkhWwotOAJ66/QkfNQzkqVtJYRBJ+jLJDW81Q35Hr/XIuBggLOPs6J6y4FP0VgA== X-Google-Smtp-Source: AGHT+IFIm9sAuhkAN9RC/oPUoiu9VvxGxV95sNFYKP/HLlooV8+ORxIOJ49qzevZcUTU5/dhYi+H X-Received: by 2002:a05:6122:4d04:b0:4d3:34b1:7211 with SMTP id fi4-20020a0561224d0400b004d334b17211mr4512692vkb.3.1712792289556; Wed, 10 Apr 2024 16:38:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712792289; cv=pass; d=google.com; s=arc-20160816; b=pDRNOLscfq7dVdCNtAD6wQMVFbpd0Ddx7Gdb76WuDyz3T+/LTgR9JpBUY24o7vn9fL Xq77U4ypb5nx2Z01689jr4F9o+0TLqprsSYG2PU+7rORTaVrmYgWXVvPV3AuALuSMC3j Mvqgr+nSvKbrH07JvmvtGXLU+iHvq2o+hjrFz2ZBBtRUdyLF9aKxCVDu7ty+ntdZPV7B GbS3kupC2yHRRkJsXf3MRbySMU1rKmUyw+Y0VeK03NvltCztLwVshCfmosmhS9EP7N6/ Sp53LMn+8bA7aeHIvcaLWcn4VfjiFh45zZ9jgyJm9fjzoZwIMQkJP3mAv+Tk7a5FKXCx mrUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4mEVmQj6ljzTugvWtfu25YZXKKJNitalhTdtyvv/vfs=; fh=Zt8IrY2CMMHW9Kpx/21MqlXdo88OGgzK4BqdSf58vDg=; b=Jq4L8E2/enYdxyN/VQaWwjw1Ai4/Uh/6ZA9YUlmEkwgyS8s0chIIF5tiBbJn0uVXMM aIg1pURpofJ4C2HpA2DeH8ImMF+fi0V823ebnafR7AX/K8nR/Db/0TYTDWEdrkAyePVo r3Tq9odwRLStBJ3R8ke3KMYoGyQb3bN7y1U9fs5xcBXK0bafX42ECaC8aL24JDziTIiI EOsJZX7YL+kr9fB0KRxfwT9hLSlhdh45vzmqprBvt5x6SL21dJ9n1IDMqHeGoIvjd2YC kfH7DAXbSoKU4zVkj5ZP8Emou15msykG6SgvqfTl+GWGdClCqnJoYX7pkl7ZhIGGKUQL ATRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cvXvIjwP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q2-20020a0ce9c2000000b0069b3d8a8e1dsi282845qvo.195.2024.04.10.16.38.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 16:38:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cvXvIjwP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 EA0421C22554 for ; Wed, 10 Apr 2024 23:38:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A84DD3EA76; Wed, 10 Apr 2024 23:38:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cvXvIjwP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D051614A8C for ; Wed, 10 Apr 2024 23:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712792282; cv=none; b=ly3bXeO4zlS0q7OV8u2JYg7IwEpAbhTECIWfZ8FBWj/9vQpAHOOZBKFowlPeK71Iph+L8/DBgge49gEiBgYDd/kzWG84OmeMzeO+s+57kimlgNpxcxYiwcjPxG/GXWiwKmVx/2LERdDH4GljQjQK/B/CSNobsoaqM2Dc7c9cvek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712792282; c=relaxed/simple; bh=3byiQjOlvBOYMNbK6uEXscUW916rvSbm1e6sOuZO2So=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=N5V/CLXh/uW/ORzejRTJztIK7byyG9msp/Wjz4MTX/MHDSuS1PWDfolF6BT4XEsV94egkqvsSX9jkPenKarpU3lUwGIaqPsFZQ8XaZjCMI61j/lbx6BLKBtzMmt6AwVFFEeTeXtkm2PDWUEatDCyf1okXK5ktXpu/xL90c5tLKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cvXvIjwP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD4B0C433F1; Wed, 10 Apr 2024 23:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712792282; bh=3byiQjOlvBOYMNbK6uEXscUW916rvSbm1e6sOuZO2So=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvXvIjwPSCnfCmSnpW/0FRKt63OYDwaSd3sGBvBeX9ca3DM9v2IgaupUkBXqLGATm LWJfndtPLFIkiAEaLFeVZHzhdqqmzSQu/+vKGEPZL+NQ7ClHdN6IvKcd3f5NNg5DT0 HFAaTvJHQCzRl5/Co98X+HWI98sliDpvGLuU4tWMtzs7c+EVagp1nBtPp5sqDCn36H ZZrC/vG5VTKf1L47SFAMLcA5wgYhe4e1hUrEAQc6hhBm1/KYym+5nC3ZIlVR6zIj64 8FIxRi1f7Gd1WfWh0US0s2Pqk3w+KS9ENjxE/IrOAa8vT8uMH8BkIB8Q7Xvwo3Lh1V eC2Pk0ZalgooA== From: SeongJae Park To: Barry Song <21cnbao@gmail.com> Cc: SeongJae Park , akpm@linux-foundation.org, linux-mm@kvack.org, baolin.wang@linux.alibaba.com, chrisl@kernel.org, david@redhat.com, hanchuanhua@oppo.com, hannes@cmpxchg.org, hughd@google.com, kasong@tencent.com, ryan.roberts@arm.com, surenb@google.com, v-songbaohua@oppo.com, willy@infradead.org, xiang@kernel.org, ying.huang@intel.com, yosryahmed@google.com, yuzhao@google.com, ziy@nvidia.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/5] mm: swap: introduce swap_free_nr() for batched swap_free() Date: Wed, 10 Apr 2024 16:37:59 -0700 Message-Id: <20240410233759.274907-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240409082631.187483-2-21cnbao@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Barry, On Tue, 9 Apr 2024 20:26:27 +1200 Barry Song <21cnbao@gmail.com> wrote: > From: Chuanhua Han > > While swapping in a large folio, we need to free swaps related to the whole > folio. To avoid frequently acquiring and releasing swap locks, it is better > to introduce an API for batched free. > > Signed-off-by: Chuanhua Han > Co-developed-by: Barry Song > Signed-off-by: Barry Song > --- > include/linux/swap.h | 5 +++++ > mm/swapfile.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+) > > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 11c53692f65f..b7a107e983b8 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h [...] > +void swap_free_nr(swp_entry_t entry, int nr_pages) > +{ > +} I found the latest mm-unstable fails build when CONFIG_SWAP is not set with errors including below, and 'git bisect' points this patch. do_mounts.c:(.text+0x6): multiple definition of `swap_free_nr'; init/main.o:main.c:(.text+0x9c): first defined here I think this should be defined as 'static inline'? I confirmed adding the two keywords as below fixes the build failure. diff --git a/include/linux/swap.h b/include/linux/swap.h index 4bf5090de0fd..5fd60d733ba8 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -562,7 +562,7 @@ static inline void swap_free(swp_entry_t swp) { } -void swap_free_nr(swp_entry_t entry, int nr_pages) +static inline void swap_free_nr(swp_entry_t entry, int nr_pages) { } Thanks, SJ [...]