From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46B5B2E7F25 for ; Tue, 26 Aug 2025 18:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756231292; cv=none; b=q9Ch4QfL7F9437xfaGJUAEZSAXlyYzGDfeJKZ2xBCvEBXAxjj7dZZlqN5nJAh5zPCfjR8b3DDUhwN8JrVZRZaZg06ECKZV+AXCpD8sca9Hqme6j0kwoTgr5Q8HumPMIJ7clVAbpsJ8KbIsDoP0WxvK0d8Z8OFnl3OQPHZkgzvQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756231292; c=relaxed/simple; bh=ZsPzngLlhnV8qcl2ZjKKiafuwl2ONmzXJcE69uIuT6U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=exfct/qihLf2G50rs6YHyWlppU1hrm1kfgdr13WWudIUrrwP1gbfZ7PpJ1Qz5W+poxtq+Bd7j14lZE/GcPDeJV55cHKgV7LpIY08WsyiKgHF08vJAkmMwoIGG9416umgnm6gtMq+QuLNUQT/Wncyl3mmezQLFmEvfqdfFNQ/DZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=WbwWflZK; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WbwWflZK" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1756231287; h=from:from:reply-to:subject:subject: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=NmKY6MkQc3HKzHukHIfBKw9ER0H4ED2SLHs/o7yHr2Y=; b=WbwWflZK374x9tt80LfgBRf+IupQVf/iyXGr7itPyUkuxFOEpIulPZy5irxj2OhFddyewp 48ZyQhY8YW43UPn9lr7lxb6cW9QVr9GQoM+Wk+CqjOmpqHpeIKhFrpth1K404H+5bGuROL V7o/TTcag4nyOyd97obXf43b1Zl4yHY= Date: Tue, 26 Aug 2025 11:01:21 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v1 01/14] mm: introduce bpf struct ops for OOM handling To: Roman Gushchin Cc: Kumar Kartikeya Dwivedi , linux-mm@kvack.org, bpf@vger.kernel.org, Suren Baghdasaryan , Johannes Weiner , Michal Hocko , David Rientjes , Matt Bobrowski , Song Liu , Alexei Starovoitov , Andrew Morton , linux-kernel@vger.kernel.org References: <20250818170136.209169-1-roman.gushchin@linux.dev> <20250818170136.209169-2-roman.gushchin@linux.dev> <87ms7tldwo.fsf@linux.dev> <1f2711b1-d809-4063-804b-7b2a3c8d933e@linux.dev> <87wm6rwd4d.fsf@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <87wm6rwd4d.fsf@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 8/25/25 10:00 AM, Roman Gushchin wrote: > Martin KaFai Lau writes: > >> On 8/20/25 5:24 PM, Roman Gushchin wrote: >>>> How is it decided who gets to run before the other? Is it based on >>>> order of attachment (which can be non-deterministic)? >>> Yeah, now it's the order of attachment. >>> >>>> There was a lot of discussion on something similar for tc progs, and >>>> we went with specific flags that capture partial ordering constraints >>>> (instead of priorities that may collide). >>>> https://lore.kernel.org/all/20230719140858.13224-2-daniel@iogearbox.net >>>> It would be nice if we can find a way of making this consistent. >> >> +1 >> >> The cgroup bpf prog has recently added the mprog api support also. If >> the simple order of attachment is not enough and needs to have >> specific ordering, we should make the bpf struct_ops support the same >> mprog api instead of asking each subsystem creating its own. >> >> fyi, another need for struct_ops ordering is to upgrade the >> BPF_PROG_TYPE_SOCK_OPS api to struct_ops for easier extension in the >> future. Slide 13 in >> https://drive.google.com/file/d/1wjKZth6T0llLJ_ONPAL_6Q_jbxbAjByp/view > > Does it mean it's better now to keep it simple in the context of oom > patches with the plan to later reuse the generic struct_ops > infrastructure? > > Honestly, I believe that the simple order of attachment should be > good enough for quite a while, so I'd not over-complicate this, > unless it's not fixable later. I think the simple attachment ordering is fine. Presumably the current link list in patch 1 can be replaced by the mprog in the future. Other experts can chime in if I have missed things. Once it needs to have an ordering api in the future, it should probably stay with mprog instead of each subsystem creating its own. The inspection tool (likely a subcmd in bpftool) can also be created to inspect the struct_ops order of a subsystem.