Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2010235rdb; Sun, 19 Nov 2023 21:42:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IE68xQoGariK5y0ctjHh67PqkobrOj4gmoML3WJyTL4CZViIFb9KBrc03uu0/U5xNVYsJxV X-Received: by 2002:a05:6a20:4418:b0:187:f58d:daf2 with SMTP id ce24-20020a056a20441800b00187f58ddaf2mr9645094pzb.58.1700458951692; Sun, 19 Nov 2023 21:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700458951; cv=none; d=google.com; s=arc-20160816; b=T4qvpa70AT8ibvR6kXw+ey8OWrVIO+BmqIIYUh0HwRul5Dl3f+5z3OrUyH+a41DdRm g+aV4Sf977sZESZJPg24gG8SY2JMu2kyE7r/56+nxn2LqlsdsxbNmc4W8OlntBhhKA6I IoW4iC/kzVR0MYy6Ki/ndc3y73ugtw6Yc4Dahz/yUhMyG5vj5b4QczrMDXJbDAYTrcy/ PgUysZQgpZKCQuvAonBdJW6WL3jOF3IdPcjmwRLgD4jbtN6tQyQ6dZxuqiR//78Gaynj PjvFNC1vdU+TCZH/DAxomOwMpwfpD+ViYPTg1h2Rc8hbZTpIBYOAvwVWEYmtCG6cOn0h P/1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=OPm0/BIBEEE3gySUjPKgpXt9KPLT8+PPVGKuVyn0Ai8=; fh=Gu1kDv0eVCD460aWqUJ2ViaNcaYHSxwPpbfErLLZIJA=; b=allZr1EmEAT40Cf2O1RtXmt+tJpyHPHLIeA2EyJ2pdXGbql4m5AaMGT3i3dhmjll7C AEXLA2VfazTtnocs3OwNrX8XfHryLbFBvGW09FQ9WzDetCqDd4waZu6Di/VNdCFV5cDg GCAIyrUlIkEBoB48x2nUQU014nc1oEM/5fYzKsgCH6RL+YnGiR/mEE5+oEXlXUqKNsQy r6XlOC+fP6rBu+6LtHXa6GfoQpCi8M7ja6O3LPn4zZ0adJz8gtebnjAFLk1V44+YD/Ji ut3EPJ68oF9zdsUqUo+xXYrLzrU86cdr3EvCi0mo9FYHXzFQTHzgHDXaZUzq+vOT52If HP5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GS3HvtEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id h17-20020a170902f55100b001cf55ddd9dasi3961132plf.439.2023.11.19.21.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 21:42:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GS3HvtEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B7AE4807D3CC; Sun, 19 Nov 2023 21:42:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230033AbjKTFlo (ORCPT + 99 others); Mon, 20 Nov 2023 00:41:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjKTFln (ORCPT ); Mon, 20 Nov 2023 00:41:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31321C5 for ; Sun, 19 Nov 2023 21:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700458900; x=1731994900; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=/7/+XwGPOEKnt1JtA+NEPBy+ni/uzk3f0T3/SJhZvXQ=; b=GS3HvtEEqOIvbdkh4BcTdjbvMNmiBf23TX2Sd9UGpltsDZN5sWGpUFOj bwLT4ZPzEsnFuKnpNLyvreV1aoutg/iT5R/CNlKl3rw2hVV6HJZi8t3md r4KFpJ0z+5OT+WrmYoTS3EriZ3dfNJesjcc2vRXJ0+/M8jAs7lmj2ofzC 5qtuF+XSrKeWhunYYkGWMoQQS7mkeHqQmn73cXnHzsmUKwH/v+MZ1nA8h urLupsKMHBu/muSWJOe7LLO7SbxWQx/unZBuqZlKr/LPN9RrweY9m+p+H kake/bD/mm9MqmZZT1OcMPo51Yo89s/jE7s1FMmCrjNZGJJQPEvZLqXp3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10899"; a="13109499" X-IronPort-AV: E=Sophos;i="6.04,212,1695711600"; d="scan'208";a="13109499" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2023 21:41:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,212,1695711600"; d="scan'208";a="14046099" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2023 21:41:37 -0800 From: "Huang, Ying" To: Chris Li Cc: Yosry Ahmed , Zhongkun He , Andrew Morton , Johannes Weiner , Nhat Pham , Seth Jennings , Dan Streetman , Vitaly Wool , linux-mm , LKML Subject: Re: [PATCH] mm:zswap: fix zswap entry reclamation failure in two scenarios In-Reply-To: (Chris Li's message of "Sun, 19 Nov 2023 21:31:30 -0800") References: <20231113130601.3350915-1-hezhongkun.hzk@bytedance.com> <8734x1cdtr.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Mon, 20 Nov 2023 13:39:35 +0800 Message-ID: <87v89xasq0.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 19 Nov 2023 21:42:00 -0800 (PST) Chris Li writes: > On Sun, Nov 19, 2023 at 7:20=E2=80=AFPM Huang, Ying wrote: >> >> Chris Li writes: >> >> > On Thu, Nov 16, 2023 at 12:19=E2=80=AFPM Yosry Ahmed wrote: >> > That will cancel the batching effect on the swap slot free, making the >> > common case for swapping faults take longer to complete, righ? >> > If I recall correctly, the uncharge is the expensive part of the swap >> > slot free operation. >> > I just want to figure out what we are trading off against. This is not >> > one side wins all situations. >> >> Per my understanding, we don't batch memcg uncharging in >> swap_entry_free() now. Although it's possible and may improve >> performance. > > swap_entry_free() does not do batching, it is at the caller level. > > I just checked. The batching is done in free_swap_slot() is still > using swap slot cache and batching. > It uses swapcache_free_entries() to batch free the swap_slots. That is > where the uncharge happens per my understanding. Per my understanding, memcg uncharging happens in swapcache_free_entries() swap_entry_free() mem_cgroup_uncharge_swap() The swap entries are uncharged one-by-one, not acquire lock in memcg uncharge all entries release lock in memcg -- Best Regards, Huang, Ying