All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Shishkin <edward.shishkin@gmail.com>
To: "Dušan Čolić" <dusanc@gmail.com>,
	reiserfs-devel <reiserfs-devel@vger.kernel.org>
Subject: Re: Question on readahead of znodes under low RAM
Date: Mon, 26 Dec 2016 20:31:09 +0200	[thread overview]
Message-ID: <586161ED.1040609@gmail.com> (raw)
In-Reply-To: <CADW=+3kuVwKOmx1nhUWz_ShDCCGg98WW-C61wd38mYuALEc6xg@mail.gmail.com>

On 12/24/2016 10:39 PM, Dušan Čolić wrote:
> znode.c line 618:
>
> /* zload with readahead */
> int zload_ra(znode * node /* znode to load */ , ra_info_t * info)
> {
> int result;
> assert("nikita-484", node != NULL);
> assert("nikita-1377", znode_invariant(node));
> assert("jmacd-7771", !znode_above_root(node));
> assert("nikita-2125", atomic_read(&ZJNODE(node)->x_count) > 0);
> assert("nikita-3016", reiser4_schedulable());
> if (info)
> formatted_readahead(node, info);
> result = jload(ZJNODE(node));
> assert("nikita-1378", znode_invariant(node));
> return result;
> }
> /* load content of node into memory */
> int zload(znode *node)
> {
> return zload_ra(node, NULL);
> }
>
>
> readahead.c line 39:
>
> #define LOW_MEM_PERCENTAGE (5)
> static int low_on_memory(void)
> {
> unsigned int freepages;
> freepages = nr_free_pages();
> return freepages < (totalram_pages * LOW_MEM_PERCENTAGE / 100);
> }
> /* start read for @node and for a few of its right neighbors */
> void formatted_readahead(znode * node, ra_info_t *info)
> {
> struct formatted_ra_params *ra_params;
> znode *cur;
> int i;
> int grn_flags;
> lock_handle next_lh;
> /* do nothing if node block number has not been assigned to node (which
> * means it is still in cache). */
> if (reiser4_blocknr_is_fake(znode_get_block(node)))
> return;
> ra_params = get_current_super_ra_params();
> if (znode_page(node) == NULL)
> jstartio(ZJNODE(node));
> if (znode_get_level(node) != LEAF_LEVEL)
> return;
> /* don't waste memory for read-ahead when low on memory */
> if (low_on_memory())
> return;
>
>
> So how is znode loaded when free RAM is < 5%?


According to this function when free RAM < 5%
actual read-ahead is not triggered, so zload() issues
a read IO request per znode.

Edward.

      reply	other threads:[~2016-12-26 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-24 20:39 Question on readahead of znodes under low RAM Dušan Čolić
2016-12-26 18:31 ` Edward Shishkin [this message]

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=586161ED.1040609@gmail.com \
    --to=edward.shishkin@gmail.com \
    --cc=dusanc@gmail.com \
    --cc=reiserfs-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.