Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp636693rwl; Wed, 9 Aug 2023 22:05:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvpCZ+IMXL4GoYxQBJ5H2UNhRUPK1TRpwimZaRvyfpz3QcSGp/zsVb1CRBMLJtM+2rDfO5 X-Received: by 2002:a17:906:3185:b0:965:6075:d100 with SMTP id 5-20020a170906318500b009656075d100mr1145320ejy.39.1691643926940; Wed, 09 Aug 2023 22:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691643926; cv=none; d=google.com; s=arc-20160816; b=0iMO1125pHoYldRd+vwVaaznA7hvca1Pdhf3l7kGwEzDbZmggqCFmmGrokVoqxd0Rn PiTsUBrt+fNuwMTbn1wxFGGiBOtWiSbVH/GGJGEqk7lovszKcVf+HGGRSuOb7YSD5bS6 r8/adXzxZfC3XNSt7JJof7Dw+K93HkdwqCUB+4ef9e/UVCVA3DW7wHUkgeWMO1kOe8TA fvPN5x5hWwJ/S+4r21H6IeUzunva9gMhs5MKpmdjgGgnH7XK2LNeuN0/b2yiz6lUtRjN schvt+p40TbuO5ELJZEt2WiTWLb6u4viW1vHXLfofzvE6TJxSLPtG5/gd99x2hZUYnAj dAEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=0vbhhkynVQi1160ixmvuJAcj7j/5EEdnNrO+9s/PfI4=; fh=LqFIkm4ZAFcUrKumTmhqNeXW3tfJHqSJxCsD/EJ7RdY=; b=e5Nt253cs9uubinlyqpD4kkXGhz1tM+5x5NtMoeJJZY0TJiJlgtR4ediMpt1P0HvJ9 plhfY22UzaEPYwhtPMBQknpQs7NW87ZS8lWyapA8UzkQaOkjSMFP36vK7MK3wbfJpRWp kLo2CNkR22HhJOuhxVVz0MKjseuei+gbq74rWzvGejk6CX6vVcLb4Qf1sbZ6+cm1Ynlq bnrvfscN3t4k6Qc3UnLtrVRmvG/QPGgfU7WYc9YWQDPM1FzwSH9eIrvgwozk2Wu+LIC5 RO0DbK8f6ILagqMX5zjfPi7z0f743USD6cPbxu8ptnqWR+LD+KF2Tl+CempCOmQp0YvN GYLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=KGn3PF5b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qc18-20020a170906d8b200b0099cc0b087f6si845023ejb.52.2023.08.09.22.05.01; Wed, 09 Aug 2023 22:05:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=KGn3PF5b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbjHJEBN (ORCPT + 99 others); Thu, 10 Aug 2023 00:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjHJEBL (ORCPT ); Thu, 10 Aug 2023 00:01:11 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23DF10E9 for ; Wed, 9 Aug 2023 21:00:46 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1b9c5e07c1bso4880255ad.2 for ; Wed, 09 Aug 2023 21:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691640046; x=1692244846; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0vbhhkynVQi1160ixmvuJAcj7j/5EEdnNrO+9s/PfI4=; b=KGn3PF5b5bR0U2Co5S+eHS/cxml/DczpmGYImARcA5vxpz4B+WCXSdVEaMEqjBD+al RmM/KPdnqf5n0N5XoeEmpFpv3/s4wnSJMBQxEduav8QJNIa1bx9+La8wDnfuOob555BK MqEiovUmsee168obtO1jF7yA5eg5wUcKA+KrqCBbGE0njU4U2OPGzskcYaHdB9HhbyeE QxoASZNGngc3ZdW6LEEdiRTel0I+LYFykzB1cOjg/q7WDeCGkeltGIlvlwyLPWJUndDt D0EwQiIt6wv6nCvmUzTwfVrwZvvuulUu/shqc5dx4U2VdR8mIYMUIyezGJu3u7HESfLT t9Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691640046; x=1692244846; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0vbhhkynVQi1160ixmvuJAcj7j/5EEdnNrO+9s/PfI4=; b=Ce7Ugwm0t1gR1or+OpV/ggnkKljdOW7OncQ6K/Ahee/Bf5hCIgtU8vjqtFtIboKrZ+ Vly0B5CPKY7KyS5JLhkSTv4UBfQ2l486gtdB2iyD+Ns/aRmYS7l6bHfX8BY1UpE8ozNw fZkz1mIx8VdChLiWctnuz36y/xEmwHckZrLXb7JYW5++fHn1JsailLm33yQGC7fEqLzh V6XaSNxMjWDrLZSwHOpyI+2pg5cWMH8OIoJaVQyeYtKel9o9FrD0LK8WEujYRWGDbiPQ KWAEi0wYJixpcWUzKpv/R+mOhZJ+c0S+OgfpVczbAnFTD7kbq89Sl9MF8Lmxpbneg47l oeNg== X-Gm-Message-State: AOJu0YwZTozikO5ic/gJ+WyDEXmOFFxQlcvAvVee6Cx+StqPiUGf2c2X gEKdgWudJcvJOJ8pWnEC5H5T7A== X-Received: by 2002:a17:903:234d:b0:1bc:16bc:9f66 with SMTP id c13-20020a170903234d00b001bc16bc9f66mr1487715plh.12.1691640046231; Wed, 09 Aug 2023 21:00:46 -0700 (PDT) Received: from [10.94.58.170] ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id h17-20020a170902f7d100b001bc930d4517sm395812plw.42.2023.08.09.21.00.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Aug 2023 21:00:45 -0700 (PDT) Message-ID: Date: Thu, 10 Aug 2023 12:00:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: Re: [RFC PATCH 1/2] mm, oom: Introduce bpf_select_task Content-Language: en-US To: Michal Hocko , Roman Gushchin Cc: Chuyi Zhou , hannes@cmpxchg.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, muchun.song@linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, robin.lu@bytedance.com References: <20230804093804.47039-1-zhouchuyi@bytedance.com> <20230804093804.47039-2-zhouchuyi@bytedance.com> <866462cf-6045-6239-6e27-45a733aa7daa@bytedance.com> From: Abel Wu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/9/23 3:53 PM, Michal Hocko wrote: > On Tue 08-08-23 14:41:17, Roman Gushchin wrote: >> It would be also nice to come up with some practical examples of bpf programs. >> What are meaningful scenarios which can be covered with the proposed approach >> and are not covered now with oom_score_adj. > > Agreed here as well. This RFC serves purpose of brainstorming on all of > this. > > There is a fundamental question whether we need BPF for this task in the > first place. Are there any huge advantages to export the callback and > allow a kernel module to hook into it? The ancient oom-killer largely depends on memory usage when choosing victims, which might not fit the need of modern scenarios. It's common nowadays that multiple workloads (tenants) with different 'priorities' run together, and the decisions made by the oom-killer doesn't always obey the service level agreements. While the oom_score_adj only adjusts the usage-based decisions, so it can hardly be translated into 'priority' semantic. How can we properly configure it given that we don't know how much memory the workloads will use? It's really hard for a static strategy to deal with dynamic provision. IMHO the oom_score_adj is just another demon. Reworking the oom-killer's internal algorithm or patching some random metrics may satisfy the immediate needs, but for the next 10 years? I doubt it. So I think we do need the flexibility to bypass the legacy usage-based algorithm, through bpf or pre-select interfaces. Regards, Abel