Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 25 Jul 2014, 01:27
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Speeding up the SnapMerge
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 5 of 6 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Author Message
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Thu 10 Feb 2011, 17:48    Post_subject:  

technosaurus wrote:
I'm not on a puppy box at the moment, but a little concerned about pausing init and subsequently running processes before unpausing it (not sure if it matters though) - maybe add a ... && $2 != "1" ... if there are problems (1 _is_ the init procsess right?)
Yes, _1_ is init. I used to have the code $2 > 2 and $3 > 2 (don't pause init and any of the [kthreads], or any processes started by them) - but pausing them seems to have no harm, I still have my files all saved, and it gives me the warm feeling that no one can spawn a process behind my back - so that's why they're included also.
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Thu 10 Feb 2011, 17:53    Post_subject:  

Dougal wrote:
It's version-dependent. My version of Busybox Ash doesn't support it. Busybox also supports "let", which is a bashism, so not safe to rely on.
Yes, probably should replace that with "expr substr $LEAF 4 500" or something like it. Or change that shell to /bin/bash. That's one of my gripe about ash - for bash, you can go to http://www.gnu.org/software/bash/manual/bashref.html and see what you can and can't do with it. There is nothing like it for ash, the closest I can find is http://linux.die.net/man/1/ash - but then busybox ash (as you said, depending on which version) can do a little bit more than that, and I can't find any documentation on busybox ash (except reading the source perhaps) - what gives? Confused
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Thu 10 Feb 2011, 19:22    Post_subject:  

In Frisbee I'm using SIGCONT to communicate with the tray. I guess if this ends up working I should probably switch it to some other signal.
Back to top
View user's profile Send_private_message Visit_website 
technosaurus


Joined: 18 May 2008
Posts: 4278

PostPosted: Thu 10 Feb 2011, 23:07    Post_subject:  

Dougal wrote:
jamesbond wrote:
In my system (and also Fluppy), /bin/ash is symlinked to busybox. Busybox ash seems to support this:
Code:
# busybox ash
# a=abcde
# echo ${a:3}
de
# exit


It isn't documented, and if you do have a link to where busybox ash is documented, I'm happy to take it on (busybox applet man page list the details of every other applet except ash).

It's version-dependent. My version of Busybox Ash doesn't support it. Busybox also supports "let", which is a bashism, so not safe to rely on.

By that logic we should only use /bin/bash if it is bash 2.x compatible ... which it probably is not ... just include a note that you may need to upgrade
AFAIK the only ash documentation is in the source tree.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Fri 11 Feb 2011, 01:38    Post_subject:  

jemimah wrote:
In Frisbee I'm using SIGCONT to communicate with the tray. I guess if this ends up working I should probably switch it to some other signal.
Or you can exclude that from being touched. Editing awk file is easier than recompiling I guess.
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Fri 11 Feb 2011, 02:17    Post_subject:  

A few crash and hangups later on the real eeepc - here comes s14. Changes:
1. wrap the whole snapmerge within freeze/unfreeze
2. don't kill init and its direct descendants (otherwise hangups in certain cases - as technosaurus said)
3. aufs remount at end of merge, apparently to force re-eval of all files (otherwise some files will be missing). I'm suspicous of this, I have to do it otherwise some weird things will happen (This validates jemimah's concern earlier). As I said, my earlier attempt with remount was disastrous. So let's hope there is no bad side effect to this.

so far, so good. I did this (and its variation, deletion etc) a couple of times when testing:
Code:
(for a in {1..10000}; do echo file$a > file$a; done) & snapmergepuppy


cheers!

EDIT: file removed, buggy, please use latest version

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13

Edited_time_total
Back to top
View user's profile Send_private_message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Sat 12 Feb 2011, 02:30    Post_subject:  

Ok I finally got to testing this. I'm really impressed so far! Saving is practically instant. I think this should be posted somewhere more visible to get more testers.

----

However opaque directories are not working. I test this in Puppeee by switching to openbox and editing /usr/local/bin/rox-menu. I change the 3rd line to

Code:
PUPMODE=12


Then I delete an application from /usr/local/applications and run fixmenus. Then I run snapmergepuppy. Then I reboot and see if the application is back in the menu or not.
Back to top
View user's profile Send_private_message Visit_website 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Sat 12 Feb 2011, 05:59    Post_subject:  

jemimah wrote:
Ok I finally got to testing this. I'm really impressed so far! Saving is practically instant. I think this should be posted somewhere more visible to get more testers.
Great ! Perhaps one of the mods can re-assign this thread to "Cutting edge" or something?

----
Quote:
However opaque directories are not working. I test this in Puppeee by switching to openbox and editing /usr/local/bin/rox-menu. I change the 3rd line to

Code:
PUPMODE=12


Then I delete an application from /usr/local/applications and run fixmenus. Then I run snapmergepuppy. Then I reboot and see if the application is back in the menu or not.

I tested under Fluppy 12. I moved Xinvaders3d from /usr/share/applications to /root, re-run fix menus, and then run snapmergepuppy. I check the menu (I run openbox with rox panel) - xinvaders is now gone, so far so good. I reboot. I checked the menu - xinvaders come back Shocked
BUT, I checked
- usr/share/applications - no more xinvaders, it's gone.
- /root/my-roxapps/Menu-Items - no more xinvaders entry.
- /initrd/pup_ro1/usr/share/applications - I see whiteout file
- /initrd/pup_ro1/root/my-roxapps/Menu-Items - I also see the whiteout file
So, as far as file deletion is concerned, it seems to work fine - deleted items are deleted. Where else could rox-panel get the menu entry from? I would need to check that.

EDIT: Found the bug, working on a solution.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Sat 12 Feb 2011, 09:08    Post_subject:  

I hope I've nailed this dir-opaque thing. It's very tricky guessing how it works - especially without reading aufs source in full.

s16 - combined all those scripts into one big bash script.
hopefully I've tackled all those "ghost" files that keeps coming back after reboot.

Let me know how you fare.

I'm going to remove all the previous uploaded files as they're all buggy so far.

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13

Edited_time_total
Back to top
View user's profile Send_private_message 
mavrothal


Joined: 24 Aug 2009
Posts: 1564

PostPosted: Sat 12 Feb 2011, 16:04    Post_subject:  

Wow Very Happy
tried s-16 in XOpup that traditionally had issues with snapmergepuppy.
No problems at all (yet). And this thing is fast!
Well done.

Now if someone can make puppy to umount the savelayer cleanly too... Wink

_________________
Kids all over the world go around with an XO laptop. They deserve one puppy (or many) too Very Happy
Back to top
View user's profile Send_private_message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Sat 12 Feb 2011, 20:59    Post_subject:  

The opaque directory thing does seem to be fixed.

I copied several hundred MB of data to RAM and ran the snap merge. It took several minutes to copy it down to the usb drive. Of course I couldn't even move the mouse the whole time.

Did you move the suspend to happen before the copy down?

I guess that's a good trade for getting my RAM back but I could see how it could be very annoying if it happened at the wrong time - like during a skype call or a presentation or something.

I think we need a way to warn the user before locking up the system for more than a second or two. Or have saving and purging RAM be separate things and the purge only happens if the user requests it.

---

Mavrothol, check out this thread.
http://murga-linux.com/puppy/viewtopic.php?t=55823
Back to top
View user's profile Send_private_message Visit_website 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Sat 12 Feb 2011, 21:42    Post_subject:  

Yes, I now freeze the whole thing before deletion - I was considering your C compiler scenario, where a process may create and delete many files continuously (e.g. when updating a previous build), and I thought it may be better to freeze the whole thing.

I can revert it back to the way it was before (around s12 or so), block only during deletion.

The following is just random thoughts:

- We need to pinpoint the source of the delay - is it the rsync, or is it the other stuff (whiteouts checking, or tmpfs deletion?).

- It's easy to separate copydown and deletion, but how can we integrate back to puppy infrastructure? I prefer not touch anything outside snapmergepuppy - I'm hoping that this script can be a dropdown replacement.

- Alternatively I can let X process to continue to run though I think it may open another can of worms ...

- Putting up an Xdialog before freezing may be a good idea also. The thing is, if you only do usual stuff (browsing, edit a few documents etc) - the volume of data to be written will be small and the delay will be relatively unnoticeable. So a big red "danger" flag before every save operation may not be warranted as well (or perhaps we can just do a du -sh /initrd/pup_rw and if the value is larger than a couple of tens MB, we should pop up a warning - what do you think?)

Let me know your thoughts. Meanwhile, I'll just modularise the script even more so that it's easier to pick and choose what we want to do.

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Sat 12 Feb 2011, 22:04    Post_subject:  

I think the delay is mainly that it is just slow to copy a lot of data to a usb drive. I was thinking of the du warning too.

Of course if we're not using a lot of RAM, there's little point in deleting so maybe just skip it if we don't need it. Perhaps just detect if we're getting low on RAM and pop up the dialog offerring to purge.

The size of the brower cache probably defaults to 100MB or something and if the user is downloading things, it's not hard to amass large files.
Back to top
View user's profile Send_private_message Visit_website 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Sat 12 Feb 2011, 22:38    Post_subject:  

Didn't incorporate your suggestion yet - I was working on it, finished it and then see your post.

Anyway - here is s17 - modularised version of s16.

Changes -
1) warn user based on size of tmpfs and number of files in tmpfs (I included both because I'm not sure which steps causes the slow down)

2) modularised the functions

It still works as before (ie pauses the whole process), but I've separated the freeze function, snapmerge function, and cleanup function. It will be easy to change so that it will only freeze during cleanup. Look at line 204 - just move the freeze_processes in-between snapmerge and cleanup.

If we can confirm that the slowdown is because of tmpfs deletion, then there's not point in doing this. But if the slowdown is because rsync - ok perhaps it's worthwhile to take additional risks for shorter freeze time.

Let me know.

Oh yes the warn_user limit is arbitrary - it really depends on how slow things are. I'll take your feedback on this. Currently I set the limit to 64MB and 1000 files.

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13

Edited_time_total
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2043
Location: The Blue Marble

PostPosted: Sat 12 Feb 2011, 22:40    Post_subject:  

mavrothal wrote:
Wow Very Happy
tried s-16 in XOpup that traditionally had issues with snapmergepuppy.
No problems at all (yet). And this thing is fast!
Well done.
Thanks.

Quote:
Now if someone can make puppy to umount the savelayer cleanly too... Wink
I thought Patriot has done this, and I'm sure that at least Fluppy, later version of Puppeee and Fatdog has this included. I'm not sure whether it makes it to the base puppy (woof) though.
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 5 of 6 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0945s ][ Queries: 12 (0.0056s) ][ GZIP on ]