Message ID | 20250114021922.92609-7-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 E125DC02180 for <linux-mm@archiver.kernel.org>; Tue, 14 Jan 2025 02:20:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E335280007; Mon, 13 Jan 2025 21:20:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69155280002; Mon, 13 Jan 2025 21:20:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 50BC0280007; Mon, 13 Jan 2025 21:20:03 -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 30702280002 for <linux-mm@kvack.org>; Mon, 13 Jan 2025 21:20:03 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E122241799 for <linux-mm@kvack.org>; Tue, 14 Jan 2025 02:20:02 +0000 (UTC) X-FDA: 83004452244.15.758BCAA Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf22.hostedemail.com (Postfix) with ESMTP id F3203C000F for <linux-mm@kvack.org>; Tue, 14 Jan 2025 02:20:00 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=eBXCco45; spf=pass (imf22.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736821201; 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=6YPnFtJFai+0xFpNHgKwg1vEFPjmUMGue3EQsxvwhos=; b=fZrMRU4jUG9IMI9UkMkER7ofU2b32C/TugIZrYRNRhAqI+jkn07UTHNZSVfIHdR/wlBow/ 6DJvpYYVaeBnl1iqd+UZQKg6Xc75kSC8lf0AT+qvIYnLPw4Aneh1Dax0QHs3TTmxMGsb+x 5SNM0+3qgshrsMHhk7IqmeATznmA32g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736821201; a=rsa-sha256; cv=none; b=n90cLXQplpW3vqaPRyRSL0HkJ8D0CBE9Epv//VT9cF9MVvViAsc4k351s5P1AAkxgjOpwA XknuTNBLOoHkRUlzDEdsYCpFSFxUTBgsKkaMkxqNAltBrM7BuOFRqjIWqQevydZNbS2zWM Csv3IzE/AnKGdoen+tkF0yTrPe8f4Fc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=eBXCco45; spf=pass (imf22.hostedemail.com: domain of alexei.starovoitov@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=alexei.starovoitov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2165448243fso105616645ad.1 for <linux-mm@kvack.org>; Mon, 13 Jan 2025 18:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736821200; x=1737426000; 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=6YPnFtJFai+0xFpNHgKwg1vEFPjmUMGue3EQsxvwhos=; b=eBXCco45qDoZtNmr98dh/kY5rPZwMpKeqFD9+wqzjgQUeS/T/HEhGvw4tl9/di9ExM V7q/2k/ztgBlUpAD3e81mWHK/PMKhBgciIFGSo6WebMesz6IxxXFVeHLQfDcR3ZoA+ce pJbJKubX3PJiHL+taQW6WuIxb1yU2ZgC1BuGzHY4ZacWYA7efbTehD/VCoQUnHex+rQn e3mHG/HjQ8TQXpiP6b72HQB2IpQwCJCmxYvHXKu7OcmReR99iVzku7XStnLbnDVjgS7n KsperUXKLXTe0HBZziJTf9skQlvzO/vigYrov0v261slaKSYa5yKCIQh3Pzz3YumpBKY ZBHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736821200; x=1737426000; 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=6YPnFtJFai+0xFpNHgKwg1vEFPjmUMGue3EQsxvwhos=; b=pNtnSh7NzIE4tP90zDLMGMUph6Du+jrqiG75Krts3KwavA/855Rafne5sOCIjoJ7hJ AueSAt/gRa7T3zki7jcrC/UQmzhrznzlJf2xweUvmZvO3XfoHfwtmREla1nz+EoKYCxO ZszRdKBmKIjyrFObS6yVNx6cziv1Zj00swrD3NmuaeAZDyYthOcPhP7Uscdl0t/2j9Xf ecfUJlJAGK+UyadR3ATFc1XdSlXRgcrvXH3Oejl5fEE20l208FAyb+iECMIyL3ITeIeh UNbW2lbSiVgfE87RNSd+Dm4N5Biff1bJn4VDbNoUm0nwtuXic1rro8OxJxXHiOKwdx2j 8VUw== X-Forwarded-Encrypted: i=1; AJvYcCWV26BcI06wMsadetxFs5JFjuqLJeY1jXjINRmNVxVeXromW15RSH2MhDQi/0W5vyo9wHkCOFBjJQ==@kvack.org X-Gm-Message-State: AOJu0YwqGNyGZUh7zhgcSxP6inUKpuGGjgBm0i2rNEYVvKD2iDtBSVVW lAtv0Am7mfjBzbnFPMmU0x0JEOr3AV+MxaZlJ5pGfGQfytahNZln X-Gm-Gg: ASbGncv17XfINNgnCSLUlVH2ystm0VC7c2LraIH3QW7momzRiwtczBNeE5ymySfm54B fBcW4x7ZsMSJAswAAtExn/czBoVlRz44JtqZUEA+cIR829lDIricjbQkr4GXXqT4ZC9XdZAiwiL oC7xdxnynitygGxVFZSDAgFDM264TavcvEXnuhI/KGS3m3EWFnFLkfWCWPDipg1Z98GxZmjF+0w 8gh6ZOg1C0ry9+rRr23cHyFG4SWt+sIrOSU8dbXWGNLJ5qCXvb4UVm5tAtJdbZNwWR+zBCYiGX+ h5tJLKcd X-Google-Smtp-Source: AGHT+IFK2Q/NzWEMQDd1zkERrN23lZllcwNoRX4XpjEtT4xySg8TTJ5FTM1kqalpNAWOVle2SSYeWQ== X-Received: by 2002:a05:6a20:4394:b0:1e3:e836:8aea with SMTP id adf61e73a8af0-1e88d18eab5mr40855550637.14.1736821199823; Mon, 13 Jan 2025 18:19:59 -0800 (PST) Received: from localhost.localdomain ([2620:10d:c090:400::5:4043]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d4056a5fesm6475293b3a.48.2025.01.13.18.19.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 18:19:59 -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, bigeasy@linutronix.de, rostedt@goodmis.org, houtao1@huawei.com, hannes@cmpxchg.org, shakeel.butt@linux.dev, mhocko@suse.com, willy@infradead.org, tglx@linutronix.de, jannh@google.com, tj@kernel.org, linux-mm@kvack.org, kernel-team@fb.com Subject: [PATCH bpf-next v4 6/6] bpf: Use try_alloc_pages() to allocate pages for bpf needs. Date: Mon, 13 Jan 2025 18:19:22 -0800 Message-Id: <20250114021922.92609-7-alexei.starovoitov@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250114021922.92609-1-alexei.starovoitov@gmail.com> References: <20250114021922.92609-1-alexei.starovoitov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: F3203C000F X-Stat-Signature: zqtbrotsaj5z4gg7i7wxy4zry4ep6nib X-Rspam-User: X-HE-Tag: 1736821200-528616 X-HE-Meta: U2FsdGVkX19GqsQA1DK7SZuH289YCkkNA9v3kf3FOYH5s4zYT3ScxAxnIEY9LsEuc62WuVvznE1HwBMmejHQvAZWO9Oz5sHnsmbL12yLow4hRWai4EkiataN2hRcCYQHKk+GvhKsdTR9vbTRgv66YLI0c+mCUUd1GUscN/gvc2Ry9L3XA5z/3sVnTI74GMQcczUVgrvjpH1WbtXo5HbphlBfODzlf4j1GK4cP+GjcWhW7JyGo/LsotUV7WUqtjXY+z71yPx+l+rKvZaRGEFGFXvczQdDEUOlXKpi94QTyWhScooIoipmVBoZJb3Dx7T++LSnooL4fXBbP/LolQ/wTk9/VG7J6IQXpzHfJDKaH9RuGcWEPFkHtYGSMixppwOWpNW3FvujoJcxiB4IWH6lDxZV/RMUjWZ9WKmmtZqCDWOqo9plKdvYORSdlh29CEKc4Mh63IoGOTH9t9VG3KbYsW4YZdzrYCYkwDH9Besu1kiSOnPeMXDblq2nN+lejFCeWEFki6RToaQUN8U2VAYl20gKnHyMMtRhWCjsYezyMnXeAouuyGyE2quGYim1bcvSLkkPPRDg7iZxTYGGcVgKYyMNZoB8OcwORYaePrpkd42o9S0Int+py9XQ2jjsDid+qOubj0VX5aztgYqIL0OGcYXLf2wkn/VWOmcgX2QioftIjp4UYCZ1+aklQhIq7+x4qVQiGgqacxRzrImmMdn6irgvaBKBqiL6xAYVHCLTRephU+qx8wTounTh+umnP2kGFqrxjwLgJ/OwhTJ0fojoIu8JMLPNkofOWIINH/m/5TPxyHR2K6LH8W6xT2dLUvBo8sUAZ7+mCYasuAOM3pSmiDFHIDt0JIHH4t/y0dRL3fzydrDcdShH2JPGv42M4HGKtmRrrJg0rBgGbz3OqkeKOuxVdyVqLZ1tdRm3cEEEQ0MIPCGW/lknhlmbKrEIrTTsco2RTcFp6r3J5aIlHd4 UwV15hD7 hhfIrGQVCACFl5NfeVY0FEGL5Hu/7/J7/Cfo+pGPl40IkK7xOlSYQm9m7yh/2dZNH9OW/8LUItVQ9d0tGMs4FoVz15R8gztgdU2tGt23+/LsR/bfQ1j3XY4JElpQ4O3ckjeBaC6u24UmQB+O48yfUhr6Jm0D2IaTqNt+fDLiGoJpgvAWrIcf0vN0jfUykt/akPQYXUuc9FAGiQgWd5GTicd4C4sEEeSyDSQjRsbFbdy6Oe3UQ5ouWCleaCJYNEoY7hNII9WQBdRMCbfCzSvCf2KWSQZQjqUzDCCDpOyHmuKn7ql4drpAR7abMvSAtQmVc23oE2sd5sbLwg0Ok+agHhS9l7BsVgEs/S7tOj6Z4Vz+T6IcuLhEMM0uDhRyI1gr88dDkmRbM5CtQaCvWrKb5s16GpL0HVk7ICCJvA41x5sHi/tt/eRm+3hpxZt8/5/vZwXaQp/8CBSVnVk2AS8GwM7dhaeeR6osGjDJEkQqnh9rl54gQSlg2TGX55Q== 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, mm: Introduce try_alloc_pages()
|
expand
|
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 0daf098e3207..8bcf48e31a5a 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -582,14 +582,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); + pg = try_alloc_pages(nid, 0); if (pg) { pages[i] = pg; continue; } for (j = 0; j < i; j++) - __free_page(pages[j]); + free_pages_nolock(pages[j], 0); ret = -ENOMEM; break; }