lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHz2CGU-0pvu=jMx88BG5e2CJCByZGQR_v=T-c+6eeOzciESPw@mail.gmail.com>
Date:	Tue, 20 May 2014 10:35:24 +0800
From:	Jianyu Zhan <nasa4836@...il.com>
To:	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc:	Rik van Riel <riel@...hat.com>, kosaki.motohiro@...fujitsu.com,
	Fengguang Wu <fengguang.wu@...el.com>,
	kamezawa.hiroyu@...fujitsu.com, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/vmscan: Do not block forever at shrink_inactive_list().

On Mon, May 19, 2014 at 10:40 PM, Tetsuo Handa
<penguin-kernel@...ove.sakura.ne.jp> wrote:
>
> Since the kernel worker thread needs to escape from the while loop so that
> alloc_page() can allocate memory (and eventually allow xfs_vm_writepage()
> to release memory), I think that we should not block forever. This patch
> introduces 30 seconds timeout for userspace processes and 5 seconds timeout
> for kernel processes.
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
> ---
>  mm/vmscan.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 32c661d..3eeeda6 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1459,13 +1459,18 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
>         int file = is_file_lru(lru);
>         struct zone *zone = lruvec_zone(lruvec);
>         struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
> +       int i = 0;
>
> -       while (unlikely(too_many_isolated(zone, file, sc))) {
> +       /* Throttle with timeout. */
> +       while (unlikely(too_many_isolated(zone, file, sc)) && i++ < 300) {
>                 congestion_wait(BLK_RW_ASYNC, HZ/10);
>
>                 /* We are about to die and free our memory. Return now. */
>                 if (fatal_signal_pending(current))
>                         return SWAP_CLUSTER_MAX;
> +               /* Kernel threads should not be blocked for too long. */
> +               if (i == 50 && (current->flags & PF_KTHREAD))
> +                       break;
>         }
>
>         lru_add_drain();

Hi, Tetsuo Handa

I think it is good to use a MACRO for this magic number instead of harding code
it, in a long-term maintainability view,  and would better with
appropriate document.

Thanks,
Jianyu Zhan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ