Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp121156lqg; Wed, 10 Apr 2024 18:29:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJC8ClD6AiOHOm2tESuKqW6r78rakZkICS/tqV0umhh+tbof1DOaOboFWpZNdLGVCC9S3FctNwoy3kMNWGFOfWsru1Yg8TClhVmwcn4Q== X-Google-Smtp-Source: AGHT+IGokPqq/4K5RXDZ4WtfkgVytI2HGytXflzGT3gUpuQKgi4HmAHlZ8w/Jwn52hDHfswbM71d X-Received: by 2002:a05:6a21:6da3:b0:1a7:a644:4485 with SMTP id wl35-20020a056a216da300b001a7a6444485mr1845701pzb.18.1712798965059; Wed, 10 Apr 2024 18:29:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712798965; cv=pass; d=google.com; s=arc-20160816; b=UBIbwOKnAcyAFeowCFKGOCwEPVkERpyK9JkVtzQGP5dMJY9HT0dBKgOT9YUh9+ezWF HJzOpVoCUiIuPs6vHQhkKwSDtTx8I5tWEJs9uJWCk/CLnnugcxEq337szIM8hJJO0gaH FkeQfAZacFgJNWPj8bKBgwjJi869L1rFXjAEj0PQZLeWKY9apCR0AxwC7iZBFX2QfeaJ C0x7y9yvRVg69tekl2umdRsDW9u/VnvHtlpd6rnwxRXhqMceCsTOT5tg1Get62w+nBSh BGA+xm0Hw31zCLSJFxj2KshJSvRdFRMt2unGXpYt7wxKec/hzAJcS4Zc3cxhhba588GA niaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=GfGZWRXSUIyqNHCgW8rswLstTfY/iXLOVHVR00RmzH4=; fh=BawiJpRyqmosPvbqb+XFbRj/8kHOUx8jiTxn1hdqnuY=; b=BKX8RUuUaRBUEwp1QbGtZ3dw416KtyqT0jbfLPFqHmjlEsGjKMixEGqPmbYTrPg1Cq i8yZKAeLHpkA0OKxDGpceQfp+CvFJZxV/evo7eG3Z1uIZsldM0u5lvF7fYI5pK7MW0WQ ah1eLQjQlIMh+WngqnzhAJeKlT+mqXIrol9kTE0p4V07Wff6C1rfXPmQ3g+q70JT+8lu i2Yh8d0sUuPHiWfK+kjqvUhk95WnDaj7TRFfGKJ4nFaBrnreZHbQCcMRy3eUHpkCo3RF uGu0EdB0loeiv8sSblD0dm2tZGKwQMbbTbtGo10avtZGLDT2IZFp7vMBnQnvtNTiomRQ 5nmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JCUjXXUC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139629-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id v64-20020a638943000000b005dbf22d8443si296787pgd.1.2024.04.10.18.29.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 18:29:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JCUjXXUC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139629-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0D4F4B24CBC for ; Thu, 11 Apr 2024 01:29:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0E1F626DD; Thu, 11 Apr 2024 01:27:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JCUjXXUC" Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAFFD6166E for ; Thu, 11 Apr 2024 01:27:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712798858; cv=none; b=svgQmR1EjXjqxlMidrb41zM6Y39U0p8A7jYcmEVBq1/KzokHkxgesRswJkoTEK3DaqwBrk1NT/VZgSLiFxLVkFCoZrjsYSyEzKvbB33hOa5TNDNWBhfcv0N2AvUQw0vf3NZlIKcS9rjlJQts4iI+JaOSZ8MX3xe1h4iDRH5MvPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712798858; c=relaxed/simple; bh=5+fNjU5bm/FNIY7nQA9jRzJPW0i8m68rgtoy0yqtfNc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MMY2byfJ87qnK2RR3HWdOYjexQRqfzn3y5LF0mljOQQjSqhPvX3OLx1KfFWfdZdQ7jhtlumy5V8VAezY3bAaVULmVja04kX2cZza2yhz16ix2tdzOAfBghf+aeQB9zzyK+z+1Icl1/npJPv6XnghF1utcft7EjIoy9/gx+OnGBo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JCUjXXUC; arc=none smtp.client-ip=209.85.222.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-f45.google.com with SMTP id a1e0cc1a2514c-7e043f577c5so220543241.1 for ; Wed, 10 Apr 2024 18:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712798856; x=1713403656; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GfGZWRXSUIyqNHCgW8rswLstTfY/iXLOVHVR00RmzH4=; b=JCUjXXUCjklpCYsqmaYUgBZhq425TRC0RW6C8myUOo+9O6gs5rS7MjIsgOmasaR32a bSN7/i5JRVHv1urMSq0wu7U0u9Y5WvbyGJ4g/euoT5nm2sHt7ZDgYvVdd1sv7snP4eUi J4e09Zv2PcvQkYoK5IbVWv7OZaN1tIsJWcIAAY7y7+dhJpf5Y8+OVVFG0sjJHIF/Zw6/ IHcJgeWrXfarBgzFmLJ5YkaOao96hBMuZ6Kmy0Q6uGeUEHSkaMW9IooCxR5OFV873wrF ir3VFmqBhMiQUqaa1Hd06EoHv36Pd9Us/JRVc/D/Px4x6SJG5fesOveVCFQ8oZcDTEou 1fBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712798856; x=1713403656; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GfGZWRXSUIyqNHCgW8rswLstTfY/iXLOVHVR00RmzH4=; b=h/RSaqekNeyN4+WMeu7Wrvmvd4cVBFhV9Nj5iILcWI6KNB5WHVJDpBIPHTycc4uf8C jugZaa9OVM5HWzWUnUTs8gWPjr/UZEedot2Da2lzBR6HKh7XKLL5qy0cC5k5Y6oCFHPt H6BwGAfKWVg2rpRfMRquUwCp8sywGHDWDsEIMz085nJ2L+JzVFT3f7p4/Pibc9Ub/AbD 4sggWzvR/uup5lA3Fw9SFGGXOvXtzfwy0YpI3gW5BZ5XnGXblyC2nCBzdvOM3Xcsjm1a rq8VoWSBcdxuaOnfHH9jxXExomfvz2Ph/3tM4I8Avoz+P8nFYsllbxNN3Anul8yLHR3L OI0A== X-Forwarded-Encrypted: i=1; AJvYcCXh9h4kV0Rh9CILpLL4wXLHwpY/YH9KiTWZKwyi+r3vHcywn6bNxZdtM10h4btARmWHGudcXm53H2lsgeNV67A9XWO/Ix0Sm3L1dUdg X-Gm-Message-State: AOJu0YyJXMw9UJbTE3fNdeYnO4eVtFMQZNvPyBd9iMxZYzO/KwePR5xl V/yHuLAHzlGWsFMu+k1nDnLP3EJFDLGbwaQ/ZVIgNl90VFPmeZCOPC9d3xaI4KsPw0tci/OwCyN 5iRFAeXSlm/gclkCmcyu6K8O2B4Q= X-Received: by 2002:ac5:c956:0:b0:4bd:54d0:e6df with SMTP id s22-20020ac5c956000000b004bd54d0e6dfmr1117988vkm.1.1712798855741; Wed, 10 Apr 2024 18:27:35 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240409082631.187483-2-21cnbao@gmail.com> <20240410233759.274907-1-sj@kernel.org> In-Reply-To: <20240410233759.274907-1-sj@kernel.org> From: Barry Song <21cnbao@gmail.com> Date: Thu, 11 Apr 2024 13:27:24 +1200 Message-ID: Subject: Re: [PATCH v2 1/5] mm: swap: introduce swap_free_nr() for batched swap_free() To: SeongJae Park Cc: 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 11, 2024 at 11:38=E2=80=AFAM SeongJae Park wrot= e: > > 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 w= hole > > folio. To avoid frequently acquiring and releasing swap locks, it is be= tter > > 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 wi= th > 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 th= e two > keywords as below fixes the build failure. definitely yes. It's highly likely that it was an oversight. we definitely meant static inline for !CONFIG_SWAP. Thanks! will fix it in v3. > > 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 > Thanks Barry