Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3408385rdh; Mon, 27 Nov 2023 13:32:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbryvWl+7KYtMaEAsDElzuQfispuVMytibp0jGbP35PlMNqhLCqBcLY5aM/3F04eheYCXG X-Received: by 2002:a05:6a21:1a4:b0:18c:8d0f:d6b9 with SMTP id le36-20020a056a2101a400b0018c8d0fd6b9mr5502155pzb.49.1701120737401; Mon, 27 Nov 2023 13:32:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701120737; cv=none; d=google.com; s=arc-20160816; b=zOctyZITgYHa8Ukj9yy+YvhRsqJn1lpuv4u8ecyXAJjtFrGJnczWfjwc79T60Lzgne 64KL6iPZc0xyWnXIZ6w69qDirpJAgulhYqV2Dmp8MHvrVdSJLXh3XgGwvOv7ZvQHTsEZ MtbgXzVe02wdRKjPYAAIWiHzF6PiykXKyN7Y18Gr5SwWqXnoWAXgq3jRxRt/LH3DOQVB xZEEc7sdLlr1xjzmTxZRefPYSV6CYjfVHVJuzG9WkWpPidFjvj/vz2YeNmabCLzNBlaV 2ldNM0WqO4b9xwOKq+rATJrS2K3o8VCubE9rYpUTlpoACK2upiJeyH2bnOhRt86SWbNs Z/MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=01/TtnGunSRoNeQivqkO3yp5gEABKRtIPv7V4mD6Leg=; fh=8lsnWvPJ3qr+SAFEGvQhSUlK2F3f/8NNoT8TRbmG0O8=; b=nnlY0iBn7PpKHtLCVCZniiHLzznw0jCRAH5mDQpfClJ4YLul0vERVNe1nosRXtFYZM ie86GoNE/oEL5m0PfPypllcfFkQiHh7njYj2EAy8OEwxTR6yHKyciRVKbYD8Da9eVe8/ Gv7XhXw5Hc046MgGe3zsIgGIpAZWMFakC91eWE6enSZWkHecr5tKw4cjFfPJ7MbxCs+A MV2MIuy+cQlAokdqpS5OWnizfvB0F/oNrzikzssWHbLFLgFzf+QrttwcWkutc5f5jcNf /kyUHDWnhfEtvQVFh+FEhM8fCjlqboc7PDsd+WWmMcZcScEC/ZCmVsYbkyCVx43JEUL+ Bj9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G7r9BuoK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u5-20020a656705000000b0056959099f46si10283286pgf.856.2023.11.27.13.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 13:32:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G7r9BuoK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 7D3DB80E709A; Mon, 27 Nov 2023 13:32:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233054AbjK0Vb5 (ORCPT + 99 others); Mon, 27 Nov 2023 16:31:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjK0Vbz (ORCPT ); Mon, 27 Nov 2023 16:31:55 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA238101 for ; Mon, 27 Nov 2023 13:32:01 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6cb74a527ceso3753063b3a.2 for ; Mon, 27 Nov 2023 13:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701120721; x=1701725521; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=01/TtnGunSRoNeQivqkO3yp5gEABKRtIPv7V4mD6Leg=; b=G7r9BuoKe5uH1VVgO33xAYale+5Zu1z3Rx8psVbVkUAc9wZcRe96neF0HgnFSGluJf 96cdqG+fZefjH5qMyOaLl9uB60CyGRY3k+EsyMh8TWHu/YrRF7o3pS5Jxgm8IfrtqG20 v4PkbYv1VO1QY47x/ok207mh1utFr6Nd8l+iMGHwpj0ljQRMarTZOcNDXmxIbX/ohWDE yvh3L+AlKCMtsQAw+TMNwjXKuLxW9CvnGVbvvnvEbjvk7vSwJrDJtNR6Re7Yimloyy46 LZrItCD3D0LS0DUW6OoNrTghvv10IIiWhW0OBUGYMqoZATBxyO8OV2B/WpRu1vvMyQF1 KU6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701120721; x=1701725521; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=01/TtnGunSRoNeQivqkO3yp5gEABKRtIPv7V4mD6Leg=; b=nnEwJBgSRznLbfWubLblRdXFntYwIWqGPEdAZM/HegFcExWk+gN8/q4e+tWQPGOvEl CsVsZ+sSAsJHA76jhHn15PkRABhB4rPzcwi3nyxx9bvl1oDWLl/SMJ+Fy7wfDqT7xN/k hGG1zcQnim9Fhdq/zyk2bMrS8r7nV4/NKSSHtlgZrE4IrNYRd39CjRxfw+OaXcDMj6wf PUS/3bx00CiAiBUXg1JFtHxp82lmCd7qRrLL1s9N66lVcdOW/mFDfvuGDmxQOL1tPL8H 332MpnYL6E+a/hkZ1DqVe8SA0C999u424YmflbH8wth/00FehSztZ0AXSLx3Z0NtMu51 SS8Q== X-Gm-Message-State: AOJu0YyS549Htu+dz09lcVrG64/X5qJyxtgS+/i+GX8YThSH/Wqe3HWX fY5GGUl1y9wZDN0WuuuejdY= X-Received: by 2002:a05:6a20:4419:b0:187:4ee0:e95e with SMTP id ce25-20020a056a20441900b001874ee0e95emr15332849pzb.52.1701120721242; Mon, 27 Nov 2023 13:32:01 -0800 (PST) Received: from google.com ([2620:0:1000:8411:393c:1828:9438:b99d]) by smtp.gmail.com with ESMTPSA id 37-20020a631365000000b005b8ea15c338sm8104364pgt.62.2023.11.27.13.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 13:32:00 -0800 (PST) Sender: Minchan Kim Date: Mon, 27 Nov 2023 13:31:58 -0800 From: Minchan Kim To: Chris Li Cc: "Huang, Ying" , Michal Hocko , Yosry Ahmed , Liu Shixin , Yu Zhao , Andrew Morton , Sachin Sant , Johannes Weiner , Kefeng Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10] mm: vmscan: try to reclaim swapcache pages if no swap space Message-ID: References: <87msv58068.fsf@yhuang6-desk2.ccr.corp.intel.com> <87h6l77wl5.fsf@yhuang6-desk2.ccr.corp.intel.com> <87bkbf7gz6.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=0.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FSL_HELO_FAKE,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 27 Nov 2023 13:32:11 -0800 (PST) On Mon, Nov 27, 2023 at 12:22:59AM -0800, Chris Li wrote: > On Mon, Nov 27, 2023 at 12:14 AM Huang, Ying wrote: > > > I agree with Ying that anonymous pages typically have different page > > > access patterns than file pages, so we might want to treat them > > > differently to reclaim them effectively. > > > One random idea: > > > How about we put the anonymous page in a swap cache in a different LRU > > > than the rest of the anonymous pages. Then shrinking against those > > > pages in the swap cache would be more effective.Instead of having > > > [anon, file] LRU, now we have [anon not in swap cache, anon in swap > > > cache, file] LRU > > > > I don't think that it is necessary. The patch is only for a special use > > case. Where the swap device is used up while some pages are in swap > > cache. The patch will kill performance, but it is used to avoid OOM > > only, not to improve performance. Per my understanding, we will not use > > up swap device space in most cases. This may be true for ZRAM, but will > > we keep pages in swap cache for long when we use ZRAM? > > I ask the question regarding how many pages can be freed by this patch > in this email thread as well, but haven't got the answer from the > author yet. That is one important aspect to evaluate how valuable is > that patch. Exactly. Since swap cache has different life time with page cache, they would be usually dropped when pages are unmapped(unless they are shared with others but anon is usually exclusive private) so I wonder how much memory we can save. > Regarding running out of swap space. That is a good point, in server > workload we don't typically run out of swap device space anyway. > > Android uses ZRAM, the story might be different. Adding Minchan here. Swap is usually almost full in Android since it compacts(i.e., swapout) background apps aggressively.