Hi Coiby,
On Mon, 22 Aug 2022 20:36:26 +0800
Coiby Xu <coxu(a)redhat.com> wrote:
Hi Philipp,
On Mon, Aug 01, 2022 at 04:58:21PM +0200, Philipp Rudo wrote:
>Hi Coiby,
>
>On Tue, 21 Jun 2022 14:57:25 +0800
>Coiby Xu <coxu(a)redhat.com> wrote:
>
>> By default, NetworkManger will manage all the network interfaces and
>> try to set interface IFF_UP to get carrier state. Regardless of whether
>> the network interface is connected to a cable or not, the NIC driver
>> will allocate memory resources for e.g. ring buffers when setting IFF_UP.
>> This could be a waste of memory. For example it's found i40e consumes ~15GB
>> on a power machine. On this machine, i40e manages four interfaces but only
>> one interface is valid. This patch use "managed=false" to tell
>> NetworkManager to not manage network interfaces that are not needed by
>> kdump by putting /etc/NetworkManager/conf.d/10-kdump-netif.conf in the
>> initramfs.
>>
>> Signed-off-by: Coiby Xu <coxu(a)redhat.com>
>> ---
>> dracut-module-setup.sh | 34 +++++++++++++++++++++++++++++++++-
>> 1 file changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
>> index 9ae3dd1..2a15e5e 100755
>> --- a/dracut-module-setup.sh
>> +++ b/dracut-module-setup.sh
>> @@ -1,6 +1,7 @@
>> #!/bin/bash
>>
>> _DRACUT_KDUMP_NM_TMP_DIR="/tmp/$$-DRACUT_KDUMP_NM"
>> +_TMP_KDUMP_NETIFS="$_DRACUT_KDUMP_NM_TMP_DIR/kdump_netifs"
>
>Could you use a bash array instead of a file here? That would reduce
>the number of file operations.
I just tried using a bash array but an unexpected problem is this
variable could be modified in a subshell thus the change doesn't
persist. It seems I have to use a file unless we avoid calling all
kdump_setup_{bond,bridge...} in a subshell.
true... although I must admit I don't understand why they are called in
a subshell in the first place. The way I see a typical call looks like
this
if kdump_is_bond "$_dev"; then
(kdump_setup_bond "$_dev") || exit 1
...
but in that case the subshell doesn't do much other than returning the
exit value of the function. So it shouldn't be a problem to drop it.
You'd only need to change the "exit 1" to "return 1" in the
kdump_setup_* and put the error handling to the first caller.
Anyway, that's probably a clean up for itself...
Thanks for the explanation
Philipp
>
>Thanks
>Philipp