Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3628474rwo; Fri, 4 Aug 2023 07:39:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNIIwVdlV0+dvvqfo9mTYUuisIy16zEKqBD6aiaBhnGbBy937BoKpTqtqC4lf5l4cfknnQ X-Received: by 2002:a17:902:a505:b0:1b9:ebf4:5d2 with SMTP id s5-20020a170902a50500b001b9ebf405d2mr1630482plq.33.1691159980843; Fri, 04 Aug 2023 07:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691159980; cv=none; d=google.com; s=arc-20160816; b=Ft/5zBKNHzzoscbU7/JVaGkm1G/SdPrlY1rVfIvCkmDpS/ZkIuEHxleO94T3ll2RpB 5WuIee/Gn56r9dsqlmcTOjH5b5ExQ52We259j0jfqMtHdhwIrneLIwhx234LMm3eJvjM 3gsWPqxqxie8rOmhrZLMpOGSrG9jSjdkgRAx2rzpUOP63dLCpdxnQapGIXpZi/FKpCTe 5fLNvwvsViDDkcqn8bUFdGYV2R9LDAXetMi+XyMJQjvy5bBEI1DUkapRsk5KB3jaP0hP sfEKM3lbxFHILZcm0P2KprLfARei1KYQnUrkvB2XGu8H62NqPghRDM/YL8z2FiQ44jwl g2GA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dC3229kXtesd2LonV8QJ5tIaAJZvEIlDNMMMi0MzLuA=; fh=dS5ezokBs3uSbMDZai6lUOon4HZG0Q9bXakGoyEosYE=; b=TlmABhTpTtsyE033qe/Xc8MUBLy4D70mJoMmDkrnlVzTFHinvCXRVSlk/FAgD7LivZ ay+Z43Mc/OQ6lWkFjixDqPq1j3w3A0+zyb3Jh+d0SoXdAq/74YDwyZQRNhNwWsK2GEAJ /KirymH+QuXFHFSb9ecGlHzE+/zKUYE71O+WaQ8NwMWyyU2btYnJS5snlq0VzIrF9Uad wBdCjMQni8m33cETEZNQHCeAIB/WktHsdinfs6ReZOPvJ5mkBZ/jNxM755WlTxOYrenY gFVT/zOXKDAzShOns9w4NrUt9XQ8AflBgvx/Oz2G4ZSE2uGidpm92l76PcjX/SFOrYbW ovEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=DeFJbWAc; 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 k14-20020a170902d58e00b001bb0ba81053si1896440plh.50.2023.08.04.07.39.28; Fri, 04 Aug 2023 07:39:40 -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=DeFJbWAc; 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 S230441AbjHDNer (ORCPT + 99 others); Fri, 4 Aug 2023 09:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjHDNeq (ORCPT ); Fri, 4 Aug 2023 09:34:46 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B3B1BF9; Fri, 4 Aug 2023 06:34:34 -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 685E71F8AB; Fri, 4 Aug 2023 13:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691156073; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dC3229kXtesd2LonV8QJ5tIaAJZvEIlDNMMMi0MzLuA=; b=DeFJbWAcdSuvcmAC25+a1fPES2q6mL+ZCOh3sOtNUFjYruRe9nDNniNxYt2Y6MnapORnGt I9U3Y4YA2Y0jOxVVoTmoNpv2W10oZV6sWz09qzfMJDeAVKCgQChfAEf/31jdqVmIzFEYAm bqi5ZfDvRLZO8Q2mxKXql+Pid58SuXc= 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 4A499133B5; Fri, 4 Aug 2023 13:34:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RKgXD2n+zGQYGgAAMHmgww (envelope-from ); Fri, 04 Aug 2023 13:34:33 +0000 Date: Fri, 4 Aug 2023 15:34:32 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 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. -- Michal Hocko SUSE Labs