Commit 44a52ffd authored by David S. Miller's avatar David S. Miller

Merge branch 'is_kdump_kernel'

Amir Vadai says:

====================
Make is_kdump_kernel() accessible from modules

I'm re-spinning this patchset. At the begining it was suggested to use a
different name for the parameter, but at the end [3] the resolution was to
leave it as it is in this patch.

Drivers need to know if running from kdump kernel in order to change their
memory profile - since kdump environment is limited by available memory.
Currently there are drivers that are using reset_devices as suggested in [2].
In [2] it was suggested to use reset_devices, but the context was, to enable
driver to know when the hardware device is needed to be reset, and not if this
is a kdump environment. We think that is_kdump_kernel() is better suited to
select between different memory profiles.

The first patch in this patchset exports a needed symbol in order to make
is_kdump_kernel() accessible from the drivers. The rest of the patches change
from reset_devices to is_kdump_kernel() in 2 networking drivers.

The idea of this patchset was suggested by Vivek Goyal.

Tested (only build) and applied on top of commit 8fc54f68: ("net: use
reciprocal_scale() helper")

[1] - ea1c1af1: ("net/mlx4_en: Reduce memory consumption on kdump kernel")
[2] - https://lkml.org/lkml/2011/1/27/341
[3] - http://www.spinics.net/lists/netdev/msg291492.html
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a77e4acc c9931896
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/crash_dump.h>
#include <net/tcp.h> #include <net/tcp.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/ip6_checksum.h> #include <net/ip6_checksum.h>
...@@ -64,7 +65,7 @@ static int bnx2x_calc_num_queues(struct bnx2x *bp) ...@@ -64,7 +65,7 @@ static int bnx2x_calc_num_queues(struct bnx2x *bp)
int nq = bnx2x_num_queues ? : netif_get_num_default_rss_queues(); int nq = bnx2x_num_queues ? : netif_get_num_default_rss_queues();
/* Reduce memory usage in kdump environment by using only one queue */ /* Reduce memory usage in kdump environment by using only one queue */
if (reset_devices) if (is_kdump_kernel())
nq = 1; nq = 1;
nq = clamp(nq, 1, BNX2X_MAX_QUEUES(bp)); nq = clamp(nq, 1, BNX2X_MAX_QUEUES(bp));
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/crash_dump.h>
#include <net/ip.h> #include <net/ip.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/tcp.h> #include <net/tcp.h>
...@@ -11956,7 +11957,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) ...@@ -11956,7 +11957,7 @@ static int bnx2x_init_bp(struct bnx2x *bp)
bp->disable_tpa = disable_tpa; bp->disable_tpa = disable_tpa;
bp->disable_tpa |= IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp); bp->disable_tpa |= IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp);
/* Reduce memory usage in kdump environment by disabling TPA */ /* Reduce memory usage in kdump environment by disabling TPA */
bp->disable_tpa |= reset_devices; bp->disable_tpa |= is_kdump_kernel();
/* Set TPA flags */ /* Set TPA flags */
if (bp->disable_tpa) { if (bp->disable_tpa) {
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/cpu_rmap.h> #include <linux/cpu_rmap.h>
#include <linux/crash_dump.h>
#include <linux/atomic.h> #include <linux/atomic.h>
...@@ -1275,7 +1276,7 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, ...@@ -1275,7 +1276,7 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
/* Returns true if running in low memory profile (kdump kernel) */ /* Returns true if running in low memory profile (kdump kernel) */
static inline bool mlx4_low_memory_profile(void) static inline bool mlx4_low_memory_profile(void)
{ {
return reset_devices; return is_kdump_kernel();
} }
#endif /* MLX4_DEVICE_H */ #endif /* MLX4_DEVICE_H */
...@@ -18,6 +18,7 @@ unsigned long saved_max_pfn; ...@@ -18,6 +18,7 @@ unsigned long saved_max_pfn;
* it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE. * it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
*/ */
unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
EXPORT_SYMBOL_GPL(elfcorehdr_addr);
/* /*
* stores the size of elf header of crash image * stores the size of elf header of crash image
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment