Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1735067rdb; Mon, 9 Oct 2023 00:34:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJvItVxOstGCagS2+ZDrNDtgag6Ed2w76DZNzWOEKQodB7tJ7NuhR6o83a+lEP2nCAOSlJ X-Received: by 2002:a05:6808:1798:b0:3ae:2024:8389 with SMTP id bg24-20020a056808179800b003ae20248389mr20262882oib.36.1696836886163; Mon, 09 Oct 2023 00:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696836886; cv=none; d=google.com; s=arc-20160816; b=LQZit9V9TC9g3MJy8i/Jw8R4fK/hAOF/bYDiDxxkk2VjtsA/vPK7b3lwxEIXUaLmwu 4zXBGzOu7o5PUR0kARqvd1lQlBxnWVspeuahuLMTrHL4pBE2rvvvVv48NCaJt+Rgw5IB V5hFBV5IPZjwepIPT0bPueGodn1BiwpnAjuHJrWExYsbVabiFd03AjqmfrBT8DQ5/0X7 Yza3qniznJXX8+dWtkPaQ5W8YlxfY54yt6GGF5PyjYtTN3RgXxJ4SPVboVnE4UWga+2U KEx9FTMmF/Ek5yNWH6xDXFklPRtU6pxdHjvFDSBijmVAMa0MJexuwDIiRtjxJckfAhdL nc/g== 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:dkim-signature; bh=Ux/+/9XoY3oQURe42Bewxjm9Kmqy/ecxPscylyqtj2E=; fh=TAc+dCtt20O7YbpZn4onBSBsA5PH9d3v35xK+IBNEcg=; b=Muo9f1l9qvFKBGXP+bWi0D3fkkunZEVrVrEEk6CAvh1G4EZRgdAIr6PM8A1lVbnM6z D0BP3M8JasGmeo9eSbtqumcRwBAvsraGSoXNMXa5SsvxPzh8ZnI2RuzcQEtQHbf9u+fZ /4EZTT+rI32swwK+bAlfVgm44r1/WpLwlnQsf1/iQhkOP/feuwPIpVNwZTj0SXVPX9DO J8vsTVymI6wo5cMgkgdOFAARkw+uYW7jc/JJD0+ZadQ3YrLd/X3WLCEOZcjHjnmEeYsS Pt91vgMpQU/d+UO/m197lMcSyE5DSv6NzRC1CXwpRkd41XfiRpXp19LVYViZb7QmvTHU PG9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Lfy+gS69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x13-20020a65538d000000b00578eafd0826si8954096pgq.398.2023.10.09.00.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 00:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Lfy+gS69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 49AD6804C624; Mon, 9 Oct 2023 00:34:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345420AbjJIHeg (ORCPT + 99 others); Mon, 9 Oct 2023 03:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345404AbjJIHef (ORCPT ); Mon, 9 Oct 2023 03:34:35 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19C2794; Mon, 9 Oct 2023 00:34:33 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BE8B11F38C; Mon, 9 Oct 2023 07:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1696836871; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ux/+/9XoY3oQURe42Bewxjm9Kmqy/ecxPscylyqtj2E=; b=Lfy+gS69AXpu3lfZDmrd8R4lwf5xDlm42obXuhcVINuRKO67ywl5EBohdpjiPdRdEyNGBV VLk/c+WHLxkMiBbEjgX96kDpRE0KRKm++tCZ7O+nlJMJ7FdicVtzFqRUkPELaayWTdU21Q IrhmIEa1KPPrqr7SSD/VXYdfxyOqIGs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9308813905; Mon, 9 Oct 2023 07:34:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZjJLIwetI2W9JAAAMHmgww (envelope-from ); Mon, 09 Oct 2023 07:34:31 +0000 Date: Mon, 9 Oct 2023 09:34:30 +0200 From: Michal Hocko To: "Huang, Ying" Cc: Jianlin Lv , tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, corbet@lwn.net, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, akpm@linux-foundation.org, yosryahmed@google.com, willy@infradead.org, linmiaohe@huawei.com, wangkefeng.wang@huawei.com, laoar.shao@gmail.com, yuzhao@google.com, wuyun.abel@bytedance.com, david@redhat.com, peterx@redhat.com, vishal.moola@gmail.com, hughd@google.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, jianlv@ebay.com Subject: Re: [PATCH] memcg: add interface to force disable swap Message-ID: References: <20231007130905.78554-1-jianlv@ebay.com> <87mswtkj8x.fsf@yhuang6-desk2.ccr.corp.intel.com> <87il7hjzdp.fsf@yhuang6-desk2.ccr.corp.intel.com> <87edi4jq19.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: <87edi4jq19.fsf@yhuang6-desk2.ccr.corp.intel.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 00:34:43 -0700 (PDT) X-Spam-Level: ** On Mon 09-10-23 13:58:10, Huang, Ying wrote: > Jianlin Lv writes: > > > On Sun, Oct 8, 2023 at 4:26 PM Huang, Ying wrote: > >> > >> Jianlin Lv writes: > >> > >> > On Sun, Oct 8, 2023 at 9:17 AM Huang, Ying wrote: > >> >> > >> >> Jianlin Lv writes: > >> >> > >> >> > From: Jianlin Lv > >> >> > > >> >> > Global reclaim will swap even if swappiness is set to 0. > >> >> > >> >> Why? Can you elaborate the situation? > >> > > >> > We reproduced the issue of pages being swapped out even when swappiness is > >> > set to 0 in the production environment through the following test program. > >> > Not sure whether this program can reproduce the issue in any environment. > >> > > >> > From the implementation of the get_scan_count code, it can be seen that, > >> > based on the current runtime situation, memory reclamation will choose a > >> > scanning method (SCAN_ANON/SCAN_FILE/SCAN_FRACT) to determine how > >> > aggressively the anon and file LRU are scanned. However, this introduces > >> > uncertainty. > >> > > >> > For the JVM issue at hand, we expect deterministic SCAN_FILE scan to avoid > >> > swapping out anon pages. > >> > >> Why doesn't memory.swap.max work? > > > > The main reason is that deployed nodes are kept on cgroups v1. Please note that cgroups v1 is in the maintenance mode with no new functionality to be added. What is the reason you are sticking with v1? > Check the code again. IIUC, for swappiness == 0, anonymous pages will > only be reclaimed if sc->file_is_tiny is true. For the memcg reclaim (i.e. not the global one) we try to avoid swapping even when file_is_tiny IIRC. > If we don't swap in that > situation, OOM may be triggerred. I don't think that it's a good idea > to do that. Or I miss something? Or even worse the system might start trashing heavily over that remaining tiny page cache. -- Michal Hocko SUSE Labs