Message ID | 20241116014854.55141-2-alexei.starovoitov@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 619F9D68BDA for <linux-mm@archiver.kernel.org>; Sat, 16 Nov 2024 01:49:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E851F6B00C1; Fri, 15 Nov 2024 20:49:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E35CA6B00C5; Fri, 15 Nov 2024 20:49:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD5546B00C6; Fri, 15 Nov 2024 20:49:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A75C56B00C1 for <linux-mm@kvack.org>; Fri, 15 Nov 2024 20:49:05 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 60C0CAD188 for <linux-mm@kvack.org>; Sat, 16 Nov 2024 01:49:05 +0000 (UTC) X-FDA: 82790272698.07.CA4D019 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf20.hostedemail.com (Postfix) with ESMTP id 1DC671C000D for <linux-mm@kvack.org>; Sat, 16 Nov 2024 01:48:05 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=e0FLtAH7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731721679; a=rsa-sha256; cv=none; b=j0d8oqGOsMKcxD0kEVZ3Lok51lqNLtCQxO6w4sS+YLTBAIeoAWsqohI9NZZI3pIT+Rs3H9 1vxwZUq8oVp0+9Cd/Apebc29rD6/zAXLRr1iJMmIHfd2nVTh781vEwBpQO8NbgKIJe1ysz vf2B8cJ/GVa17kOezefQ04V596jJE4U= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=e0FLtAH7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731721679; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EQx3r5mMfkKCKYgKnvoSO6BlBctlynKxVbPBT4K9QIk=; b=Ztv4kqL3PE5vp6EjAuQeglzKLRySNICXCuTYNL91J2/Up61ovHZFg8veT8WpTw2DLUv3C7 7NHYXf3c7a1l/oeCGKgl7QmhoxM7LwwrqXrn1jqYWitvOq7aXc85a7VWWkyK/E0JkUeEuV rXH5ts69gfaYBGOogkGwopJlGihDgbs= Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2e9b55b83d2so1037148a91.3 for <linux-mm@kvack.org>; Fri, 15 Nov 2024 17:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731721742; x=1732326542; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EQx3r5mMfkKCKYgKnvoSO6BlBctlynKxVbPBT4K9QIk=; b=e0FLtAH7FDd9Vsit0GvcQ7E1j7wx/a+S3KHl9/GrRbMiR07rUZnLUro02p07wQRpsc KJ+ep4dVvQ8ElfoouuMydX7MjIW6K9nKAIaYoDmATtOC3Ph2bVN/+ptoJ7ufTNvTfxlZ hIdWgGyVBnoteh7ELA5gaRcfjQvb5pGfcjHS/DGYA93iQ+XlVl0Zg3FQp8upN524oltO iCX0dK+NKUSXP4fi1xLZsfCXNvroS6OZxaSlUGi9ZDaHKf29jAfXKClIk1kfpRV+st1o RTPpGzI1T+Z/sogQ3lsxbRZajEmtXgNMkkWBQ7W40Jb+CIsDkJ0iR0sj5R5AIFMKY+II fJiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731721742; x=1732326542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EQx3r5mMfkKCKYgKnvoSO6BlBctlynKxVbPBT4K9QIk=; b=I4rO7FuX/pH5L62BfX5q/Ivk+1ih9Awax93xvIWlvOFxjtZbePstPDqUvYQXvRP5o8 /hsJn2IJFenEPP3FVox8iHaK8Ctx5qbuqqQ/sqhH8tTqktLIrwzozfh3NvqTkf7tbWHY 40Aa4J1frs2nmizWwQ7Kw/49iSB9yD6CpnNOk4OIIQIzw8N+Xqf7NlMDaktaDG9BJvz1 sabVK0ZcnnAYBggq0hRn7YKdmqmOiSmC9iIY3jhhYn60zpVE5zLcbcrpSxczeInOE2+0 yyFsiTJjGprVOhzOVTd5YIE0xxa16C8MxLRVtxA5U4XBX1GhuBicKF8HE79DZrcVrIpR pjgw== X-Forwarded-Encrypted: i=1; AJvYcCUPeqXs4QQwK37W9rgpFgxOdqNnuKNlWY3+C9/e2hVbfZPakS6LN5bqeDvUgSGm+S9xVHU8KR3PXA==@kvack.org X-Gm-Message-State: AOJu0Yy3W3R+qjXFxDwXcAyJGg0WzPXUdfe7u1/VMUfhzPlfNY9x9n3Y IOdVJ6mKC/YV30cXvTjSJSBQ8nDmdoNzR6Dnmnn4x3WPaVU18hB1 X-Google-Smtp-Source: AGHT+IEgHpH9AjNO4IF0+21XofZgAxvjxp9bfZDCDBA88H84ASylOHL4q9vvZJ9MPtwKF8HTV/85lw== X-Received: by 2002:a17:90b:48c4:b0:2e2:bd7a:71ea with SMTP id 98e67ed59e1d1-2ea154cf3c7mr6322465a91.8.1731721742130; Fri, 15 Nov 2024 17:49:02 -0800 (PST) Received: from macbook-pro-49.lan ([2603:3023:16e:5000:1863:9460:a110:750b]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea02495986sm3606970a91.15.2024.11.15.17.48.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Nov 2024 17:49:01 -0800 (PST) From: Alexei Starovoitov <alexei.starovoitov@gmail.com> To: bpf@vger.kernel.org Cc: andrii@kernel.org, memxor@gmail.com, akpm@linux-foundation.org, peterz@infradead.org, vbabka@suse.cz, houtao1@huawei.com, hannes@cmpxchg.org, shakeel.butt@linux.dev, mhocko@suse.com, tj@kernel.org, linux-mm@kvack.org, kernel-team@fb.com Subject: [PATCH bpf-next 2/2] bpf: Use try_alloc_page() to allocate pages for bpf needs. Date: Fri, 15 Nov 2024 17:48:54 -0800 Message-Id: <20241116014854.55141-2-alexei.starovoitov@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20241116014854.55141-1-alexei.starovoitov@gmail.com> References: <20241116014854.55141-1-alexei.starovoitov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: 1DC671C000D X-Rspamd-Server: rspam01 X-Stat-Signature: y63gmypy5ys391549jisuj85j961y5mq X-HE-Tag: 1731721685-808896 X-HE-Meta: U2FsdGVkX19YBRdd/ZBQpBtEuxpVT2nKoTpAqSN8uaSnv5XLQbgpa82LfgrMbI7ImWabHDFJ/H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TtR3+J0ewEBsw4UThBbxtgr1oFNu39e+9DB307KKmlarTJlIOQyypmbQliBoYcI2RVhYl4a4oaiiVH0JCOcsvzOqArrlx6pOP014ba0uqBw/kzzz+aOLnoNsNUfxqSXde2yM8meVmDATBRcBxN0r5DGV1ygMOv5G9Jmrdgr0F25PcYQec2ONxzciKkcrN9of9WsoCeLo8t4iSdHKt+jy0UYQnSGea+44+2TBo+kyfav6bjqU25d+aRJFB0/TmAqPBsJ7yNuEUYisukiHoICwxMR0GS6a9eCj5g9lszhoaB/vI7WKBQUJtJSrUQL37Tg5JxjDGyaow== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[bpf-next,1/2] mm, bpf: Introduce __GFP_TRYLOCK for opportunistic page allocation
|
expand
|
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 58190ca724a2..26e6cffb2fe9 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -581,12 +581,14 @@ int bpf_map_alloc_pages(const struct bpf_map *map, gfp_t gfp, int nid, old_memcg = set_active_memcg(memcg); #endif for (i = 0; i < nr_pages; i++) { - pg = alloc_pages_node(nid, gfp | __GFP_ACCOUNT, 0); + /* TODO: add async memcg charge */ + pg = try_alloc_page(nid); if (pg) { pages[i] = pg; continue; } + /* TODO: add async page free */ for (j = 0; j < i; j++) __free_page(pages[j]); ret = -ENOMEM;