Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2656911rwb; Mon, 7 Aug 2023 00:52:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEM13h3NcnSD/M0QIed1dRZm+FX7MWQWOlYbG/rA8sUfJSoars8S057fm3p2t3EdZUHdgzE X-Received: by 2002:a05:6402:35d5:b0:522:c226:34ea with SMTP id z21-20020a05640235d500b00522c22634eamr7117705edc.7.1691394729920; Mon, 07 Aug 2023 00:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691394729; cv=none; d=google.com; s=arc-20160816; b=TNq+ASRx4Rt/JutDe3pdRZLNtQDtBqrQaDDA/jGIBJPz0m1z4yt8KNtN9N4n1nqbuZ xzEasjp/QvdxHWU5+1Ywu3q8KH+ia0OfK9qL32Chvb46Vgz/xajDwna4XjCXWQa+RRIB LMlZwizDC+sX1bZV0Cr3VlqGCTPs3UL5uP7QXhxny2KWvXFayaZnHZt/qfsXk2vdVQGn e4hwMrH4RmyUWvGoXjgn4/6XJ9vBSqvE7n2UvK1EqqfquuNsxqgMP6Lj/Nc10cvkbWsn flFgKqTjAjFbdpm6hbTtVKJXZDUzK/LHMgMCQVr/29LeHzPM4iHuKKV1FPvAKAiElUGo +wsA== 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=bTuF2TgB1pBwN8OkG1rHpu4xeWoKn3NkiBu7ZL/kjNo=; fh=dS5ezokBs3uSbMDZai6lUOon4HZG0Q9bXakGoyEosYE=; b=06rwaHBVF4jZxmPVsdkWKpgUfX/u6L7aHJz1lrJPVAF+vcXo+6IpIbBomMWkDaKhPH z5RunS7IewXHwy0ThXSwXBA2/41GHTgVpzUZ/9Fu5F8n6O3DZ249APYqDJuxGRPqtACA 9R0BOxp5LmIfh5jUl8PsSZMdNyPTAfCkcLvc/4JW27IoLRCjPamPF/t027g7YfLOh/+J Ec/qPpj7EOJbns3ZnKGVAgLwzvxoQmjj6Sm2fGuCcltaeOGAHrzJd9hjYi/30vGPEkha QKLvSSSOgwQgU2vn0vtkmHobfy/Yo1CSKtnQn+nM5aI7Em8vGBHjN22loXw+u8GWMwNK 7vig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=b+BEiZrO; 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=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020aa7c392000000b00521ab8e67dbsi2305417edq.226.2023.08.07.00.51.44; Mon, 07 Aug 2023 00:52:09 -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=@suse.com header.s=susede1 header.b=b+BEiZrO; 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=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbjHGHFJ (ORCPT + 99 others); Mon, 7 Aug 2023 03:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbjHGHFH (ORCPT ); Mon, 7 Aug 2023 03:05:07 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDD951BCF; Mon, 7 Aug 2023 00:04:36 -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 C98401F460; Mon, 7 Aug 2023 07:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691391874; 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=bTuF2TgB1pBwN8OkG1rHpu4xeWoKn3NkiBu7ZL/kjNo=; b=b+BEiZrOazh2iKNnKC3SDf37eCGPzo5Aktuj/Bb87LGLBIIPO0oKrfVZECh/ZUHZQ99A3c I3vc76WsiiUEN9tTFrpjkAy6FTYDwpr9s0sxVhGg2tqAN3zAA3EYGD9Tyz5KJbN4X4u7Lp b/oocpwiNVjz3VbAlTQNFBjjSQyLl8g= 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 AAB8013910; Mon, 7 Aug 2023 07:04:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id k5euJoKX0GSvWAAAMHmgww (envelope-from ); Mon, 07 Aug 2023 07:04:34 +0000 Date: Mon, 7 Aug 2023 09:04:34 +0200 From: Michal Hocko To: Chuyi Zhou Cc: hannes@cmpxchg.org, roman.gushchin@linux.dev, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, muchun.song@linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, wuyun.abel@bytedance.com, robin.lu@bytedance.com Subject: Re: [RFC PATCH 1/2] mm, oom: Introduce bpf_select_task Message-ID: References: <20230804093804.47039-1-zhouchuyi@bytedance.com> <20230804093804.47039-2-zhouchuyi@bytedance.com> <866462cf-6045-6239-6e27-45a733aa7daa@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <866462cf-6045-6239-6e27-45a733aa7daa@bytedance.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Mon 07-08-23 10:21:09, Chuyi Zhou wrote: > > > 在 2023/8/4 21:34, Michal Hocko 写道: > > On Fri 04-08-23 21:15:57, Chuyi Zhou wrote: > > [...] > > > > + switch (bpf_oom_evaluate_task(task, oc, &points)) { > > > > + case -EOPNOTSUPP: break; /* No BPF policy */ > > > > + case -EBUSY: goto abort; /* abort search process */ > > > > + case 0: goto next; /* ignore process */ > > > > + default: goto select; /* note the task */ > > > > + } > > > > > > Why we need to change the *points* value if we do not care about oom_badness > > > ? Is it used to record some state? If so, we could record it through bpf > > > map. > > > > Strictly speaking we do not need to. That would require BPF to keep the > > state internally. Many will do I suppose but we have to keep track of > > the victim so that the oom killer knows what to kill so I thought that > > it doesn't hurt to keep track of an abstract concept of points as well. > > If you think this is not needed then oc->points could be always 0 for > > bpf selected victims. The value is not used anyway in the proposed > > scheme. > > > > Btw. we will need another hook or metadata for the reporting side of > > things. Generally dump_header() to know what has been the selection > > policy. > > > OK. Maybe a integer like policy_type is enough to distinguish different > policies and the default method is zero. Or we can let BPF return a string > like policy_name. > > Which one should I start implementing in next version? Do you have a better > idea? String seems to be more descriptive. -- Michal Hocko SUSE Labs