From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Christoph Hellwig <hch@lst.de>,
Sasha Levin <alexander.levin@verizon.com>
Subject: [PATCH 4.9 092/104] xfs: remove kmem_zalloc_greedy
Date: Fri, 6 Oct 2017 10:52:10 +0200 [thread overview]
Message-ID: <20171006083854.484367139@linuxfoundation.org> (raw)
In-Reply-To: <20171006083840.743659740@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <darrick.wong@oracle.com>
[ Upstream commit 08b005f1333154ae5b404ca28766e0ffb9f1c150 ]
The sole remaining caller of kmem_zalloc_greedy is bulkstat, which uses
it to grab 1-4 pages for staging of inobt records. The infinite loop in
the greedy allocation function is causing hangs[1] in generic/269, so
just get rid of the greedy allocator in favor of kmem_zalloc_large.
This makes bulkstat somewhat more likely to ENOMEM if there's really no
pages to spare, but eliminates a source of hangs.
[1] http://lkml.kernel.org/r/20170301044634.rgidgdqqiiwsmfpj%40XZHOUW.usersys.redhat.com
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2: remove single-page fallback
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/xfs/kmem.c | 18 ------------------
fs/xfs/kmem.h | 2 --
fs/xfs/xfs_itable.c | 6 ++----
3 files changed, 2 insertions(+), 24 deletions(-)
--- a/fs/xfs/kmem.c
+++ b/fs/xfs/kmem.c
@@ -24,24 +24,6 @@
#include "kmem.h"
#include "xfs_message.h"
-/*
- * Greedy allocation. May fail and may return vmalloced memory.
- */
-void *
-kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize)
-{
- void *ptr;
- size_t kmsize = maxsize;
-
- while (!(ptr = vzalloc(kmsize))) {
- if ((kmsize >>= 1) <= minsize)
- kmsize = minsize;
- }
- if (ptr)
- *size = kmsize;
- return ptr;
-}
-
void *
kmem_alloc(size_t size, xfs_km_flags_t flags)
{
--- a/fs/xfs/kmem.h
+++ b/fs/xfs/kmem.h
@@ -69,8 +69,6 @@ static inline void kmem_free(const void
}
-extern void *kmem_zalloc_greedy(size_t *, size_t, size_t);
-
static inline void *
kmem_zalloc(size_t size, xfs_km_flags_t flags)
{
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -361,7 +361,6 @@ xfs_bulkstat(
xfs_agino_t agino; /* inode # in allocation group */
xfs_agnumber_t agno; /* allocation group number */
xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */
- size_t irbsize; /* size of irec buffer in bytes */
xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */
int nirbuf; /* size of irbuf */
int ubcount; /* size of user's buffer */
@@ -388,11 +387,10 @@ xfs_bulkstat(
*ubcountp = 0;
*done = 0;
- irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
+ irbuf = kmem_zalloc_large(PAGE_SIZE * 4, KM_SLEEP);
if (!irbuf)
return -ENOMEM;
-
- nirbuf = irbsize / sizeof(*irbuf);
+ nirbuf = (PAGE_SIZE * 4) / sizeof(*irbuf);
/*
* Loop over the allocation groups, starting from the last
next prev parent reply other threads:[~2017-10-06 8:55 UTC|newest]
Thread overview: 143+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 8:50 [PATCH 4.9 000/104] 4.9.54-stable review Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 001/104] drm_fourcc: Fix DRM_FORMAT_MOD_LINEAR #define Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 002/104] drm: bridge: add DT bindings for TI ths8135 Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 003/104] GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 005/104] ARM: dts: exynos: Add CPU OPPs for Exynos4412 Prime Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 006/104] clk: sunxi-ng: fix PLL_CPUX adjusting on H3 Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 007/104] RDS: RDMA: Fix the composite message user notification Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 008/104] ARM: dts: r8a7790: Use R-Car Gen 2 fallback binding for msiof nodes Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 009/104] MIPS: Ensure bss section ends on a long-aligned address Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 010/104] MIPS: fix mem=X@Y commandline processing Greg Kroah-Hartman
2017-10-06 9:10 ` Mathieu Malaterre
2017-10-06 9:18 ` Greg Kroah-Hartman
2017-10-06 9:21 ` Mathieu Malaterre
2017-10-06 8:50 ` [PATCH 4.9 011/104] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 012/104] MIPS: ralink: Fix a typo in the pinmux setup Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 013/104] MIPS: ralink: Fix incorrect assignment on ralink_soc Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 014/104] power: supply: axp288_fuel_gauge: Fix fuel_gauge_reg_readb return on error Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 015/104] scsi: be2iscsi: Add checks to validate CID alloc/free Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 016/104] ARM: dts: am335x-chilisom: Wakeup from RTC-only state by power on event Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 017/104] igb: re-assign hw address pointer on reset after PCI error Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 018/104] extcon: axp288: Use vbus-valid instead of -present to determine cable presence Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 019/104] reset: ti_syscon: fix a ti_syscon_reset_status issue Greg Kroah-Hartman
2017-10-06 8:50 ` [PATCH 4.9 021/104] clk/axs10x: Clear init field in driver probe Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 022/104] usb: make the MTK XHCI driver compile for older MIPS SoCs Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 023/104] hwmon: (gl520sm) Fix overflows and crash seen when writing into limit attributes Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 024/104] iio: adc: imx25-gcq: Fix module autoload Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 025/104] iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 026/104] iio: adc: hx711: Add DT binding for avia,hx711 Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 027/104] IB/rxe: Add a runtime check in alloc_index() Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 028/104] IB/rxe: Fix a MR reference leak in check_rkey() Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 029/104] ARM: 8635/1: nommu: allow enabling REMAP_VECTORS_TO_RAM Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 030/104] drm/i915/psr: disable psr2 for resolution greater than 32X20 Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 031/104] serial: 8250: moxa: Store num_ports in brd Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 032/104] tty: goldfish: Fix a parameter of a call to free_irq Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 033/104] serial: 8250_port: Remove dangerous pr_debug() Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 034/104] IB/ipoib: Fix deadlock over vlan_mutex Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 035/104] IB/ipoib: rtnl_unlock can not come after free_netdev Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 036/104] IB/ipoib: Replace list_del of the neigh->list with list_del_init Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 037/104] arm: dts: mt2701: Add subsystem clock controller device nodes Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 038/104] drm/amdkfd: fix improper return value on error Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 039/104] USB: serial: mos7720: fix control-message error handling Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 040/104] USB: serial: mos7840: " Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 041/104] sfc: get PIO buffer size from the NIC Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 042/104] pinctrl: mvebu: Use seq_puts() in mvebu_pinconf_group_dbg_show() Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 043/104] partitions/efi: Fix integer overflow in GPT size calculation Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 044/104] ASoC: dapm: handle probe deferrals Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 045/104] audit: log 32-bit socketcalls Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 046/104] ath10k: prevent sta pointer rcu violation Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 047/104] spi: pxa2xx: Add support for Intel Gemini Lake Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 048/104] iommu/arm-smmu: Set privileged attribute to default instead of unprivileged Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 049/104] usb: chipidea: vbus event may exist before starting gadget Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 051/104] ASoC: dapm: fix some pointer error handling Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 052/104] drm: mali-dp: Fix destination size handling when rotating Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 053/104] drm: mali-dp: Fix transposed horizontal/vertical flip Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 054/104] HID: wacom: release the resources before leaving despite devm Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 055/104] MIPS: Lantiq: Fix another request_mem_region() return code check Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 056/104] mips: ath79: clock:- Unmap region obtained by of_iomap Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 057/104] lkdtm: Fix Oops when unloading the module Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 058/104] net: core: Prevent from dereferencing null pointer when releasing SKB Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 059/104] net/packet: check length in getsockopt() called with PACKET_HDRLEN Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 060/104] team: fix memory leaks Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 062/104] udp: disable inner UDP checksum offloads in IPsec case Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 063/104] net: dsa: b53: Include IMP/CPU port in dumb forwarding mode Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 064/104] qed: Fix possible system hang in the dcbnl-getdcbx() path Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 065/104] mmc: sdio: fix alignment issue in struct sdio_func Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 066/104] bridge: netlink: register netdevice before executing changelink Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 067/104] Btrfs: fix segmentation fault when doing dio read Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 068/104] Btrfs: fix potential use-after-free for cloned bio Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 069/104] sata_via: Enable hotplug only on VT6421 Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 070/104] hugetlbfs: initialize shared policy as part of inode allocation Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 071/104] kasan: do not sanitize kexec purgatory Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 073/104] netfilter: invoke synchronize_rcu after set the _hook_ to NULL Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 074/104] MIPS: IRQ Stack: Unwind IRQ stack onto task stack Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 075/104] iommu/exynos: Block SYSMMU while invalidating FLPD cache Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 076/104] [media] exynos-gsc: Do not swap cb/cr for semi planar formats Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 077/104] MIPS: smp-cps: Fix retrieval of VPE mask on big endian CPUs Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 078/104] nvme-rdma: handle cpu unplug when re-establishing the controller Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 079/104] netfilter: nfnl_cthelper: fix incorrect helper->expect_class_max Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 080/104] parisc: perf: Fix potential NULL pointer dereference Greg Kroah-Hartman
2017-10-06 8:51 ` [PATCH 4.9 081/104] nfs: make nfs4_cb_sv_ops static Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 082/104] ibmvnic: Free tx/rx scrq pointer array when releasing sub-crqs Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 083/104] cpufreq: intel_pstate: Update pid_params.sample_rate_ns in pid_param_set() Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 084/104] x86/acpi: Restore the order of CPU IDs Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 085/104] iommu/io-pgtable-arm: Check for leaf entry before dereferencing it Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 086/104] arm64: kasan: avoid bad virt_to_pfn() Greg Kroah-Hartman
2017-10-06 18:13 ` Mark Rutland
2017-10-07 3:10 ` Levin, Alexander (Sasha Levin)
2017-10-08 15:20 ` Mark Rutland
2017-10-09 9:14 ` Mark Brown
2017-10-09 10:06 ` Will Deacon
2017-10-09 11:42 ` Greg Kroah-Hartman
2017-10-09 14:00 ` Levin, Alexander (Sasha Levin)
2017-10-09 15:47 ` Mark Brown
2017-10-09 16:23 ` Levin, Alexander (Sasha Levin)
2017-10-09 16:27 ` Will Deacon
2017-10-09 16:30 ` Mark Brown
2017-10-09 17:29 ` Levin, Alexander (Sasha Levin)
2017-10-09 14:10 ` Mark Brown
2017-10-09 16:33 ` Laura Abbott
2017-10-10 17:22 ` Levin, Alexander (Sasha Levin)
2017-10-10 17:31 ` Julia Lawall
2017-11-15 17:43 ` Josh Hunt
2017-11-16 23:13 ` alexander.levin
2017-11-16 23:24 ` Josh Hunt
2017-11-17 8:06 ` Greg Kroah-Hartman
2017-10-07 8:42 ` Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 087/104] mm/cgroup: avoid panic when init with low memory Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 088/104] rds: ib: add error handle Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 089/104] md/raid10: submit bio directly to replacement disk Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 090/104] netfilter: nf_tables: set pktinfo->thoff at AH header if found Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 091/104] i2c: meson: fix wrong variable usage in meson_i2c_put_data Greg Kroah-Hartman
2017-10-06 8:52 ` Greg Kroah-Hartman [this message]
2017-10-06 8:52 ` [PATCH 4.9 093/104] ASoC: wm_adsp: Return an error on write to a disabled volatile control Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 094/104] libata: transport: Remove circular dependency at free time Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 095/104] ARM: dts: BCM5301X: Fix memory start address Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 096/104] tools/power turbostat: bugfix: GFXMHz column not changing Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 097/104] IB/qib: fix false-postive maybe-uninitialized warning Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 099/104] ASoC: rt5514: fix gcc-7 warning Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 100/104] ASoC: rt5659: drop double const Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 101/104] ASoC: rt5660: remove " Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 102/104] ALSA: au88x0: avoid theoretical uninitialized access Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 103/104] [media] ttpci: address stringop overflow warning Greg Kroah-Hartman
2017-10-06 8:52 ` [PATCH 4.9 104/104] s390/mm: make pmdp_invalidate() do invalidation only Greg Kroah-Hartman
2017-10-06 14:08 ` [PATCH 4.9 000/104] 4.9.54-stable review Guenter Roeck
2017-10-07 9:38 ` Greg Kroah-Hartman
2017-10-06 18:06 ` Shuah Khan
2017-10-07 9:39 ` Greg Kroah-Hartman
2017-10-07 14:44 ` Guenter Roeck
2017-10-08 7:20 ` Greg Kroah-Hartman
2017-10-07 16:56 ` Tom Gall
2017-10-08 7:23 ` Greg Kroah-Hartman
2017-10-09 20:37 ` Tom Gall
2017-10-10 7:11 ` Greg Kroah-Hartman
2017-10-10 15:23 ` Dan Rue
2017-10-10 15:33 ` Greg Kroah-Hartman
2017-10-10 15:54 ` Dan Rue
2017-10-10 16:05 ` Greg Kroah-Hartman
2017-10-10 23:11 ` Mark Brown
2017-10-10 15:23 ` Tom Gall
2017-10-10 15:33 ` Greg Kroah-Hartman
2017-10-10 18:39 ` Guenter Roeck
2017-10-10 18:50 ` Greg Kroah-Hartman
2017-10-10 23:14 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171006083854.484367139@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=alexander.levin@verizon.com \
--cc=darrick.wong@oracle.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).